<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_environment_file(filename, world_size=(60, 60)):
 """ Extract information about spatial resources from an environment file. Arguments: filename - a string representing the path to the environment file. world_size - a tuple representing the x and y coordinates of the world. (default: 60x60) Returns a list of lists of sets indicating the set of resources available at each x,y location in the Avida grid. """


    infile = open(filename)
    lines = infile.readlines()
    infile.close()

    tasks = []

    # Find all spatial resources and record which cells they're in
    res_order = []
    res_dict = {}
    for line in lines:
        if line.startswith("GRADIENT_RESOURCE"):
            name, cells = parse_gradient(line, world_size)
        elif line.startswith("CELL"):
            name, cells = parse_cell(line, world_size)
        elif line.startswith("REACTION"):
            task = parse_reaction(line)
            if task not in tasks:
                tasks.append(task)
        else:
            continue

        dict_increment(res_dict, name, cells)
        if name not in res_order:
            res_order.append(name)

    # Create a map of niches across the environment and return it
    grid = make_niche_grid(res_dict, world_size)

    return EnvironmentFile(grid, res_order, world_size, filename, tasks)