'identifier: Can be an email or a remote server uuid.'

def api_auth(self, identifier):

    if is_remote_server(identifier):
        api_key = self.get_server_api_key(identifier)
    else:
        api_key = self.get_api_key(identifier)
    credentials = (u'%s:%s' % (identifier, api_key))
    return {'HTTP_AUTHORIZATION': (u'Basic    ' + base64.b64encode(credentials.encode('utf-8')).decode('utf-8'))}
