import yaml


def load_from_yml(filename):
    """Load an experiment configuration from a yaml file. For examples,
    take a look at `data` folder

    Args:
        filename (str): The name of the data file (use full or relative path)

    Returns:
          tuple: The first value in the tuple is an iterable of cars in a
            sequence. The second returned value is a mapping with ensemble and
            number of black cars as keys and values, respectively.

    """

    with open(filename, 'r') as file_handle:
        data = next(iter(yaml.safe_load_all(file_handle)))
    sequence = data['sequence']
    k = data['counts']
    return sequence, k