from typing import Union


def check_group(filename: str, groups: list) -> Union[str, None]:
    """Helper function to check if a group exists for a given filename.

    Args:
        filename (str): Name of file to be checked.
        groups (list): List of groups.

    Returns:
        Union[str, None]: Returns None if group is not present, else the group name.
    """
    for group in groups:
        if group in filename:
            return group
    return "None"