def METHOD_NAME(request):
    couch_user = getattr(request, 'couch_user', None)
    if couch_user is not None:
        username = couch_user.username
    else:
        username = ''
    domain = getattr(request, 'domain', '')
    return ApiIdentifier(username=username, domain=domain)