def restrict_file_by_forms(file):
    """Restrict the entire file if it is associated to restricted forms.
    
    :param file: a file model object.
    :returns: the file model object potentially tagged as "restricted".

    """
    tags = [f.tags for f in file.forms]
    tags = [tag for tag_list in tags for tag in tag_list]
    restricted_tags = [tag for tag in tags if tag.name == u'restricted']
    if restricted_tags:
        restricted_tag = restricted_tags[0]
        if restricted_tag not in file.tags:
            file.tags.append(restricted_tag)
    return file