import collections
import json
from datetime import datetime

from coalib.misc.Decorators import get_public_members


class JSONEncoder(json.JSONEncoder):
    def default(self, obj):
        new_obj = obj
        if isinstance(obj, collections.Iterable):
            return list(obj)
        elif isinstance(obj, datetime):
            return obj.isoformat()
        elif hasattr(obj, "__getitem__") and hasattr(obj, "keys"):
            return dict(obj)
        elif hasattr(obj, "__dict__"):
            return {member: getattr(obj, member)
                    for member in get_public_members(obj)}

        return json.JSONEncoder.default(self, obj)

import collections
import json
from datetime import datetime

from coalib.misc.Decorators import get_public_members


class JSONEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, collections.Iterable):
            return list(obj)
        elif isinstance(obj, datetime):
            return obj.isoformat()
        elif hasattr(obj, "__getitem__") and hasattr(obj, "keys"):
            return dict(obj)
        elif hasattr(obj, "__dict__"):
            return {member: getattr(obj, member)
                    for member in get_public_members(obj)}

        return json.JSONEncoder.default(self, obj)

Remove unneeded line