Is there a good way to find out what color a material is at a certain point in python?

Hi, I’m pretty new to blender coding, and I want to get the color of a material at a point in 3d space in python. I’ve been searching for a while, but I have no idea how to even approach this problem. How would I do this in python?

My material is just this simple node setup, but I would ideally want to expand this to more complex materials.

material