def is_member(user, groups):
    """ Test if a user belongs to any of the groups provided.

    This function is meant to be used by the user_passes_test decorator to control access
    to views.

    Parameters
    ----------
    user : django.contrib.auth.models.User
        The user which we are trying to identify that belongs to a certain group.
    groups : list of str
        A list of the groups we are checking if the user belongs to.

    Returns
    ---------
    bool
        True if the user belongs to any of the groups. False otherwise
    """
    return any(map(lambda g: user.groups.filter(name=g).exists(), groups))