Collect the kwargs of this step and inputs passed to the constructor (recursively)
    Returns: dictionary of name: kwargs pairs where name is the name of
        a step and kwargs is its kwargs minus inputs. If the step doesn't have
        a name __class__.__name__ is used.

def _collect_kwargs(step, drop_duplicate_names=True):
    """
    Collect the kwargs of this step and inputs passed to the constructor (recursively)
    Returns: dictionary of name: kwargs pairs where name is the name of
        a step and kwargs is its kwargs minus inputs. If the step doesn't have
        a name __class__.__name__ is used.
    """
    dicts = {}
    duplicates = set()

    for s in _expand_inputs(step):
        name = s.name if s.name is not None else s.__class__.__name__
        if name in dicts.keys():
            if drop_duplicate_names:
                duplicates.add(name)
            else:
                raise ValueError("Duplicate step names: %s" % name)

        d = dict(s._kwargs)
        d = {k: v for k, v in d.items()
             if not (isinstance(v, Step) or util.is_instance_collection(v, Step))}
        dicts[name] = d

    dicts = {k: v for k, v in dicts.items() if k not in duplicates}
    return dicts