def tags_encode(tags):
    """Encodes the list of tags. Trimmed to maximum 5 tags.

    :param tags: the list of tags; max 5 will be taken
    :rtype: list of str
    """
    if tags is None:
        return None
    return list(set(str(t) for t in tags))[:5]