def build_dict(lst1, lst2=[]):
    """
    Build dictionary based on one or two lists.
    Args:
        lst1
        lst2
    Returns:
        two dictionaries, the second one is the reverse of the first
    """
    if lst2 == []:
        key2val = {i: val for (i, val) in enumerate(lst1)}
        val2key = {val: i for (val, i) in enumerate(lst1)}
    else:
        assert len(lst1) == len(lst2), (
            "Error in building dictionary: "
            "the two lists do not have the same length")
        key2val = {key: val for (key, val) in zip(lst1, lst2)}
        val2key = {val: key for (key, val) in zip(lst1, lst2)}
        
    return (key2val, val2key)