def getmatchingfiles(pattern1, pattern2, list):
    """
    From a list of files get a new sorted list of files matching both patterns 1 and 2
    :param pattern1:
    :param pattern2:
    :param list:
    :return:
    """
    return [file for file in sorted(list) if pattern1 in file and pattern2 in file]