code: def git_ls_remote(self, uri, ref):
          
          logger.debug("Invoking git to retrieve commit id for repo %s...", uri)
          lsremote_output = subprocess.check_output(['git',
                                                     'ls-remote',
                                                     uri,
                                                     ref])
          if b"\t" in lsremote_output:
              commit_id = lsremote_output.split(b"\t")[0]
              logger.debug("Matching commit id found: %s", commit_id)
              return commit_id
          else:
              raise ValueError("Ref \"%s\" not found for repo %s." % (ref, uri))
docs: Determine the latest commit id for a given ref.
  
          Args:
              uri (string): git URI
              ref (string): git ref
  
          Returns:
              str: A commit id