import re


def _retrieve_token(request):
    """Retrieve NEXUS token from the request header."""
    auth_string = request.headers.get('Authorization')
    try:
        match = re.match("Bearer (.+)", auth_string)
    except TypeError:
        match = None
    if match:
        return match.groups()[0]