# Path: g_sorcery/compatibility.py
# class TemporaryDirectory(object):
#     def __init__(self):
#     def __del__(self):


import json
import importlib
from .compatibility import basestring
"""



def step_to_raw_serializable(obj):
    """
    Make one step of convertion of object
    to the type that is serializable
    by the json library.

    None return value signifies an error.
    """
    if hasattr(obj, "serialize"):
        if hasattr(obj, "deserialize"):
            module = obj.__class__.__module__
            name = obj.__class__.__name__
            value = obj.serialize()
            return {"python_module" : module,
                    "python_class" : name,
                    "value" : value}
        else:
            return obj.serialize()
    return None


def to_raw_serializable(obj):
    """
    Convert object to the raw serializable type.
    Logic is the same as in the standard json encoder.
    """

# Path: g_sorcery/compatibility.py
# class TemporaryDirectory(object):
#     def __init__(self):
#     def __del__(self):


# Path: g_sorcery/serialization.py
import json
import importlib
from .compatibility import basestring

"""



def step_to_raw_serializable(obj):
    """
    Make one step of convertion of object
    to the type that is serializable
    by the json library.

    None return value signifies an error.
    """
    if hasattr(obj, "serialize"):
        if hasattr(obj, "deserialize"):
            module = obj.__class__.__module__
            name = obj.__class__.__name__
            value = obj.serialize()
            return {"python_module" : module,
                    "python_class" : name,
                    "value" : value}
        else:
            return obj.serialize()
    return None


def to_raw_serializable(obj):
    """
    Convert object to the raw serializable type.
    Logic is the same as in the standard json encoder.
    """

    if isinstance(obj, basestring) \