<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def has_group(user, group_name):
    '''
    This allows specification group-based permissions in templates.
    In most instances, creating model-based permissions and giving
    them to the desired group is preferable.
    '''
    if user.groups.filter(name=group_name).exists():
        return True
    return False