def METHOD_NAME(obj: Any) -> Optional[jpy.JType]:
    """
    Returns an object that is safe to pass to Java. Callers should take care to ensure that this happens
    in a liveness scope that reflects the lifetime of the reference to be passed to Java.
    The implementation will return a Java object that can be passed over jpy as a java.lang.Object. An
    existing java.lang.Object passed in to this method will be returned as-is, a JObjectWrapper will be
    unwrapped to return its underlying Java object, and anything else will be wrapped in a LivePyObjectWrapper.
    https://github.com/deephaven/deephaven-core/issues/1775
    """
    if obj is None:
        return None
    if isinstance(obj, JObjectWrapper):
        return obj.j_object
    if isinstance(obj, jpy.JType):
        return obj
    # We must return a java object, so wrap in a PyObjectLivenessNode so that the server's liveness tracking
    # will correctly notify python that the object was released
    return JLivePyObjectWrapper(obj)