import attr


def DictParameter(default=None, factory=dict, **kwargs):
    """Adds a dict parameter:

    Args:
        default (optional, dict): Default value. Default: None.
        base (optional, callabe): Factory function, e.g. dict
            or collections.OrderedDict. Default: dict.
    """
    if default is not None:
        return attr.ib(default, **kwargs)
    return attr.ib(factory=factory, **kwargs)