def resolve_task_type(type_id, tasks, user):
    task_type = None

    if not (type_id and type_id in tasks.keys()):
        abort(httplib.NOT_FOUND)
    elif not user.is_eligible_for(type_id):
        abort(httplib.FORBIDDEN)
    else:
        task_type = tasks[type_id]

    return task_type


# Borrowed from elasticutils
Finds albums, optionally matching a predicate.
dataset/ETHPy150Open mrgambal/vulyk/vulyk/utils.py/resolve_task_type--crossover with--dataset/ETHPy150Open bzimmer/pysmug/pysmug/smugfind.py/SmugFind.albums