def to_dict(self, default=None):
        dictionary = {}
        for e in self.sequence:
            dictionary[e[0]] = e[1]
        if default is None:
            return dictionary
        else:
            if hasattr(default, '__call__'):
                return collections.defaultdict(default, dictionary)
            else:
                return collections.defaultdict(lambda: default, dictionary)
Converts sequence of (Key, Value) pairs to a dictionary.
dataset/ETHPy150Open EntilZha/PyFunctional/functional/pipeline.py/Sequence.to_dict