import re


def check_files(files, count_limit, size_limit):
    """
    Check if uploaded files are conforming given requirements.
    """
    if len(files) == 0:
        return False, "No file was uploaded"
    elif len(files) > count_limit:
        return False, "Limit on amount of files exceeded"

    for file in files:
        if file.size > size_limit:
            return False, "Limit on file size exceeded"

        if re.search(r'[^a-zA-Z0-9_\-\.]', file.name):
            return False, "File name contains invalid characters"

    return True, None