code: def full_path_from_dirrecord(self, rec, rockridge=False):
          '''
          A method to get the absolute path of a directory record.
          Parameters:
           rec - The directory record to get the full path for.
           rockridge - Whether to get the rock ridge full path.
          Returns:
           A string representing the absolute path to the file on the ISO.
          '''
          if not self._initialized:
              raise pycdlibexception.PyCdlibInvalidInput('This object is not yet initialized; call either open() or new() to create an ISO')
          ret = b''
          if isinstance(rec, dr.DirectoryRecord):
              encoding = 'utf-8'
              if self.joliet_vd is not None and id(rec.vd) == id(self.joliet_vd):
                  encoding = 'utf-16_be'
              slash = '/'.encode(encoding)
              if rec.is_root:
                  return '/'
              if rockridge and rec.rock_ridge is None:
                  raise pycdlibexception.PyCdlibInvalidInput('Cannot generate a Rock Ridge path on a non-Rock Ridge ISO')
              parent = rec
              while parent is not None:
                  if not parent.is_root:
                      if rockridge and parent.rock_ridge is not None:
                          ret = slash + parent.rock_ridge.name() + ret
                      else:
                          ret = slash + parent.file_identifier() + ret
                  parent = parent.parent
          else:
              if rec.parent is None:
                  return '/'
              if rec.file_ident is not None:
                  encoding = rec.file_ident.encoding
              else:
                  encoding = 'utf-8'
              slash = '/'.encode(encoding)
              udfparent = rec
              while udfparent is not None:
                  ident = udfparent.file_identifier()
                  if ident != b'/':
                      ret = slash + ident + ret
                  udfparent = udfparent.parent
          if sys.version_info >= (3, 0):
              return ret.decode(encoding)
          return ret.decode(encoding).encode('utf-8')