def get_latest(dir_list):
    """Returns the newest month or year from a list of directories"""
    int_list = []
    for directory in dir_list:
        try:
            int_list.append(int(directory))
        except ValueError:
            pass
    if not int_list:
        return None
    return max(int_list)