code: def resolve_source(source, dep, resolve_context, resolve_cb=None):
      last_resolution_error = None
      for location in _dep_resource_locations(dep):
          try:
              source_paths = _resolve_source_for_location(
                  source, dep, location, resolve_context
              )
          except resolverlib.ResolutionError as e:
              last_resolution_error = e
          except Exception as e:
              _unknown_source_resolution_error(source, dep, e)
          else:
              for path in source_paths:
                  try:
                      resolved = _resolve_source_for_path(
                          path,
                          location,
                          source,
                          resolve_context.run.dir,
                          resolve_context.resolve_flag_refs,
                      )
                  except _SourceSkipped:
                      pass
                  else:
                      if resolve_cb:
                          resolve_cb(resolved)
              return source_paths
      assert last_resolution_error
      _source_resolution_error(source, dep, last_resolution_error)
  
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 19 for calling a global function with example usage: resolve_source(source, dep, resolve_context, resolve_cb) and returns: source_paths