import json
from datetime import datetime


def load(filename):
    """load the data from file
    retrieves station and timing information from a json file

    Args:
        filename: string filename for a valid json file

    Returns:
        list: list of lists
            station_names
            timing lists
    """
    # load json data
    with open(filename, 'r') as json_file:
        file_data = json.load(json_file)
    # get and print(station list)
    # stations are assigned letters starting from A
    station_list = [train['station'] for train in file_data]
    # get timing lists
    vertical_lists = [train['stops'] for train in file_data]
    for each_list in vertical_lists:
        for index, timing in enumerate(each_list):
            # substiture DOES_NOT_STOP with None
            # the NoneType is easier to use than string for checking
            if timing == u'DOES_NOT_STOP':
                each_list[index] = None
            else:
                each_list[index] = datetime.strptime(timing, "%H.%M")

    return station_list, vertical_lists