How can I check if an email was confirmed?

Hi, I’m using a custom coded login, and I would like to know if there is any way to check whether an email has been confirmed yet or no, as to create an error message for the login.
What I would like to do is to show that error message if the email entered in the email input field has been registered but not yet confirmed by the user.