<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_iter(cls, data, name=None):
 """Convenience method for loading data from an iterable. Defaults to numerical indexing for x-axis. Parameters data: iterable An iterable of data (list, tuple, dict of key/val pairs) name: string, default None Name of the data set. If None (default), the name will be set to ``'table'``. """


        if not name:
            name = 'table'
        if isinstance(data, (list, tuple)):
            data = {x: y for x, y in enumerate(data)}

        values = [{'idx': k, 'col': 'data', 'val': v}
                  for k, v in sorted(data.items())]
        return cls(name, values=values)