code: def _source_target_path(source, source_path, source_origin):
      target_path_attr = source.target_path or source.resdef.target_path
      if source.preserve_path:
          if target_path_attr:
              log.warning(
                  "target-path '%s' specified with preserve-path - ignoring",
                  target_path_attr,
              )
          return os.path.relpath(
              os.path.dirname(source_path), source_origin
          )
      return target_path_attr or source.resdef.target_path or ""
  
imports: import os
  import re
  import logging
  import typing
  from guild import cli
  from guild import resolver
  from guild import resourcedef
  from guild import util
label_desc: Use image node_id 30 for calling a global function with example usage: _source_target_path(source, source_path, source_origin) and returns: unknown, os