Progress – IRL, how can programmers determine if something is already available in the form of a library instead of writing the code themselves

How do real programmers decide if they should write a code or look for it in the available libraries?

Would real programmers check the language documents for each module / object / function of the code they are writing? Or do you regularly scan the libraries to know what's out there?

This assumes that you want to be efficient.