<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def email_has_role(self, email, role_name, uuid=None):
 """Determine if an email is associated with a role. Args: email (str):
 user email role_name (str):
 user role uuid (str):
 optional uuid. defaults to self.cuuid Raises: PyLmodUnexpectedData: Unexpected data was returned. requests.RequestException: Exception connection error Returns: bool: True or False if email has role_name """

        mbr_data = self.get_membership(uuid=uuid)
        docs = []
        try:
            docs = mbr_data['response']['docs']
        except KeyError:
            failure_message = ('KeyError in membership data - '
                               'got {0}'.format(mbr_data))
            log.exception(failure_message)
            raise PyLmodUnexpectedData(failure_message)
        if len(docs) == 0:
            return False
        has_role = any(
            (x.get('email') == email and x.get('roleType') == role_name)
            for x in docs
        )
        if has_role:
            return True
        return False