code: def _find_dr_record_by_name(vd, path, encoding):
      '''
      An internal function to find an directory record on the ISO given an ISO
      or Joliet path.  If the entry is found, it returns the directory record
      object corresponding to that entry.  If the entry could not be found,
      a pycdlibexception.PyCdlibInvalidInput exception is raised.
      Parameters:
       vd - The Volume Descriptor to look in for the Directory Record.
       path - The ISO or Joliet entry to find the Directory Record for.
       encoding - The string encoding used for the path.
      Returns:
       The directory record entry representing the entry on the ISO.
      '''
      if not utils.starts_with_slash(path):
          raise pycdlibexception.PyCdlibInvalidInput('Must be a path starting with /')
      root_dir_record = vd.root_directory_record()
      if path == b'/':
          return root_dir_record
      splitpath = utils.split_path(path)
      currpath = splitpath.pop(0).decode('utf-8').encode(encoding)
      entry = root_dir_record
      tmpdr = dr.DirectoryRecord()
      while True:
          child = None
          thelist = entry.children
          lo = 2
          hi = len(thelist)
          while lo < hi:
              mid = (lo + hi) // 2
              tmpdr.file_ident = currpath
              if thelist[mid] < tmpdr:
                  lo = mid + 1
              else:
                  hi = mid
          index = lo
          if index != len(thelist) and thelist[index].file_ident == currpath:
              child = thelist[index]
          if child is None:
              break
          if child.rock_ridge is not None and child.rock_ridge.child_link_record_exists():
              child = child.rock_ridge.cl_to_moved_dr
              if child is None:
                  break
          if not splitpath:
              return child
          if not child.is_dir():
              break
          entry = child
          currpath = splitpath.pop(0).decode('utf-8').encode(encoding)
      raise pycdlibexception.PyCdlibInvalidInput('Could not find path')