def serialize(self, value):
        if not value:
            return value
        elif not isinstance(value, (list, tuple)):
            return self.serialize([value])[0]

        # elif isinstance(obj, dict):
        #     return dict((k, serialize(v, request=request)) for k, v in obj.iteritems())
        try:
            serializer = self.registry[type(value[0])]
        except __HOLE__:
            return value

        attrs = serializer.get_attrs(item_list=value)
        return [serializer(o, attrs=attrs.get(o, {})) for o in value]
dataset/ETHPy150Open getsentry/freight/freight/api/serializer/manager.py/SerializerManager.serialize