def get_current_authuser():
    """
    Gets kallithea user from threadlocal tmpl_context variable if it's
    defined, else returns None.
    """
    from tg import tmpl_context
    try:
        return getattr(tmpl_context, 'authuser', None)
    except TypeError:
        return None
