def parse_key_vals(key_vals):
    """
    Parse `KEY=VAL` pairs collected from the commandline
    Turns: ``['k1=v1', 'k2=v2']``
    Into: ``{'k1': 'v1', 'k2': 'v2'}``
    Parameters
    ----------
    key_vals : tuple or list
    Raises
    ------
    ValueError
        Key=val pair does not contain an '='
    Returns
    -------
    dict
        Parsed {'key': 'val'} pairs
    """
    for pair in key_vals:
        if '=' not in pair:
            raise ValueError("Key=val pair does not contain an '=': {}".
                format(pair))
    return dict(pair.split('=') for pair in key_vals)
