def _numpy_safe_msgpack_encoder(obj):
    if ('numpy' in sys.modules):
        import numpy
        if isinstance(obj, (numpy.generic, numpy.ndarray)):
            if numpy.isscalar(obj):
                return obj.item()
            return obj.tolist()
    return obj
def _numpy_safe_msgpack_encoder(obj):
    if ('numpy' in sys.modules):
        import numpy
        if isinstance(obj, (numpy.generic, numpy.ndarray)):
            if numpy.isscalar(obj):
                return obj.item()
            return obj.tolist()
    return obj