<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_key_by_email(self, email, secret=False):
 """Find user's key based on their email address. :param str email: The email address to search for. :param bool secret: If True, search through secret keyring. """

        for key in self.list_keys(secret=secret):
            for uid in key['uids']:
                if re.search(email, uid):
                    return key
        raise LookupError("GnuPG public key for email %s not found!" % email)