code: def getContactByUsername(cls, username):
          
  
          # Check if the User is linked already
          pc = api.portal.get_tool("portal_catalog")
          contacts = pc(portal_type=cls.portal_type,
                        getUsername=username)
  
          # No Contact assigned to this username
          if len(contacts) == 0:
              return None
  
          # Multiple Users assigned, this should never happen
          if len(contacts) > 1:
              logger.error("User '{}' is bound to multiple Contacts '{}'".format(
                  username, ",".join(map(lambda c: c.Title, contacts))))
              return map(lambda x: x.getObject(), contacts)
  
          # Return the found Contact object
          return contacts[0].getObject()
docs: Convenience Classmethod which returns a Contact by a Username