'Retrieve the user_id given by the caveats on the macaroon.
Does *not* validate the macaroon.
Args:
macaroon (pymacaroons.Macaroon): The macaroon to validate
Returns:
(str) user id
Raises:
AuthError if there is no user_id caveat in the macaroon'

def get_user_id_from_macaroon(self, macaroon):

    user_prefix = 'user_id    =    '
    for caveat in macaroon.caveats:
        if caveat.caveat_id.startswith(user_prefix):
            return caveat.caveat_id[len(user_prefix):]
    raise AuthError(self.TOKEN_NOT_FOUND_HTTP_STATUS, 'No    user    caveat    in    macaroon', errcode=Codes.UNKNOWN_TOKEN)
