def to_marshallable_type(obj):
    """
    Helper for converting an object to a dictionary only if it is not
    dictionary already or an indexable object nor a simple type
    """
    if obj is None:
        return None
    if hasattr(obj, '__marshallable__'):
        return obj.__marshallable__()
    if hasattr(obj, '__getitem__'):
        return obj
    return dict(obj.__dict__)
