code: def to_j_flink_time(time_delta):
      gateway = get_gateway()
      TimeUnit = gateway.jvm.java.util.concurrent.TimeUnit
      Time = gateway.jvm.org.apache.flink.api.common.time.Time
      if isinstance(time_delta, timedelta):
          total_microseconds = round(
              time_delta.total_seconds() * 1000 * 1000
          )
          return Time.of(total_microseconds, TimeUnit.MICROSECONDS)
      else:
          # time delta in milliseconds
          total_milliseconds = time_delta
          return Time.milliseconds(total_milliseconds)
  
file_path: flink/flink-python/pyflink/util/java_utils.py
imports: from datetime import timedelta
  from py4j.java_gateway import JavaClass, get_java_class, JavaObject
  from py4j.protocol import Py4JJavaError
  from pyflink.java_gateway import get_gateway
label_desc: Use image node_id 2 for calling a global function with example usage: to_j_flink_time(time_delta) and returns: Time, Time