def METHOD_NAME(self, obj):
    """Encodes objects for types that aren't handled by the default
    encoder."""
    if tf.available and isinstance(obj, tf.TensorShape):
        items = obj.as_list() if obj.rank is not None else None
        return {"class_name": "TensorShape", "items": items}
    return get_json_type(obj)