code: def resolve_rpath(lib_path, rpaths):
      
      if not lib_path.startswith('@rpath/'):
          return lib_path
  
      lib_rpath = lib_path.split('/', 1)[1]
      for rpath in rpaths:
          rpath_lib = realpath(pjoin(rpath, lib_rpath))
          if os.path.exists(rpath_lib):
              return rpath_lib
  
      warnings.warn(
          "Couldn't find {0} on paths:\n\t{1}".format(
              lib_path,
              '\n\t'.join(realpath(path) for path in rpaths),
              )
          )
      return lib_path
docs: Return `lib_path` with its `@rpath` resolved
  
      If the `lib_path` doesn't have `@rpath` then it's returned as is.
  
      If `lib_path` has `@rpath` then returns the first `rpaths`/`lib_path`
      combination found.  If the library can't be found in `rpaths` then a
      detailed warning is printed and `lib_path` is returned as is.
  
      Parameters
      ----------
      lib_path : str
          The path to a library file, which may or may not start with `@rpath`.
      rpaths : sequence of str
          A sequence of search paths, usually gotten from a call to `get_rpaths`.
  
      Returns
      -------
      lib_path : str
          A str with the resolved libraries realpath.