code: def _adjust_to_origin(arg, origin, unit):
      """
      Helper function for to_datetime.
      Adjust input argument to the specified origin
  
      Parameters
      ----------
      arg : list, tuple, ndarray, Series, Index
          date to be adjusted
      origin : 'julian' or Timestamp
          origin offset for the arg
      unit : string
          passed unit from to_datetime, must be 'D'
  
      Returns
      -------
      ndarray or scalar of adjusted date(s)
      """
      if origin == "julian":
          original = arg
          j0 = Timestamp(0).to_julian_date()
          if unit != "D":
              raise ValueError("unit must be 'D' for origin='julian'")
          try:
              arg = arg - j0
          except TypeError:
              raise ValueError(
                  "incompatible 'arg' type for given "
                  "'origin'='julian'"
              )
  
          # premptively check this for a nice range
          j_max = Timestamp.max.to_julian_date() - j0
          j_min = Timestamp.min.to_julian_date() - j0
          if np.any(arg > j_max) or np.any(arg < j_min):
              raise tslibs.OutOfBoundsDatetime(
                  "{original} is Out of Bounds for "
                  "origin='julian'".format(original=original)
              )
      else:
          # arg must be numeric
          if not (
              (is_scalar(arg) and (is_integer(arg) or is_float(arg)))
              or is_numeric_dtype(np.asarray(arg))
          ):
              raise ValueError(
                  "'{arg}' is not compatible with origin='{origin}'; "
                  "it must be numeric with a unit specified ".format(
                      arg=arg, origin=origin
                  )
              )
  
          # we are going to offset back to unix / epoch time
          try:
              offset = Timestamp(origin)
          except tslibs.OutOfBoundsDatetime:
              raise tslibs.OutOfBoundsDatetime(
                  "origin {origin} is Out of Bounds".format(
                      origin=origin
                  )
              )
          except ValueError:
              raise ValueError(
                  "origin {origin} cannot be converted "
                  "to a Timestamp".format(origin=origin)
              )
  
          if offset.tz is not None:
              raise ValueError(
                  "origin offset {} must be tz-naive".format(offset)
              )
          offset -= Timestamp(0)
  
          # convert the offset to the unit of the arg
          # this should be lossless in terms of precision
          offset = offset // tslibs.Timedelta(1, unit=unit)
  
          # scalars & ndarray-like can handle the addition
          if is_list_like(arg) and not isinstance(
              arg, (ABCSeries, ABCIndexClass, np.ndarray)
          ):
              arg = np.asarray(arg)
          arg = arg + offset
      return arg
  
imports: from datetime import datetime, time
  from functools import partial
  import numpy
  from pandas._libs import tslib, tslibs
  from pandas._libs.tslibs import Timestamp, conversion, parsing
  from pandas._libs.tslibs.parsing import DateParseError, _format_is_iso, _guess_datetime_format, parse_time_string
  from pandas._libs.tslibs.strptime import array_strptime
  from pandas.compat import zip
  from pandas.core.dtypes.common import ensure_object, is_datetime64_dtype, is_datetime64_ns_dtype, is_datetime64tz_dtype, is_float, is_integer, is_integer_dtype, is_list_like, is_numeric_dtype, is_object_dtype, is_scalar
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
  from pandas.core.dtypes.missing import notna
  from pandas import compat
  from pandas.core import algorithms
label_desc: Use image node_id 6 for calling a global function with example usage: _adjust_to_origin(arg, origin, unit) and returns: arg