<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_email(self, token):
 """Fetches email address from email API endpoint"""

        resp = requests.get(self.emails_url,
                            params={'access_token': token.token})
        emails = resp.json().get('values', [])
        email = ''
        try:
            email = emails[0].get('email')
            primary_emails = [e for e in emails if e.get('is_primary', False)]
            email = primary_emails[0].get('email')
        except (IndexError, TypeError, KeyError):
            return ''
        finally:
            return email