Convert an instance of an object into a dict.

def to_dict(obj):
    """ Convert an instance of an object into a dict.
    """
    d = _to_json_type(obj)
    if isinstance(d, dict):
        return scrub_dict(d)
    else:
        raise ValueError("The value provided must be an object.")