'Lookup a Person from an Email Address'

@staticmethod
def lookup_person(address):

    s3db = current.s3db
    if ('<' in address):
        address = address.split('<')[1].split('>')[0]
    ptable = s3db.pr_person
    ctable = s3db.pr_contact
    query = (((((ctable.value == address) & (ctable.contact_method == 'EMAIL')) & (ctable.pe_id == ptable.pe_id)) & (ptable.deleted == False)) & (ctable.deleted == False))
    possibles = current.db(query).select(ptable.id, limitby=(0, 2))
    if (len(possibles) == 1):
        return possibles.first().id
    return None
