code: def get_string_u_at_rva(self, rva, max_length = 2**16, encoding=None):
          
  
          # If the RVA is invalid let the exception reach the callers. All
          # call-sites of get_string_u_at_rva() will handle it.
          data = self.get_data(rva, 2)
          # max_length is the maximum count of 16bit characters needs to be
          # doubled to get size in bytes
          max_length <<= 1
  
          requested = min(max_length, 256)
          data = self.get_data(rva, requested)
          # try to find null-termination
          null_index = -1
          while True:
              null_index = data.find(b'\x00\x00', null_index + 1)
              if null_index == -1:
                  data_length = len(data)
                  if data_length < requested or data_length == max_length:
                      null_index = len(data) >> 1
                      break
                  else:
                      # Request remaining part of data limited by max_length
                      data += self.get_data(rva + data_length, max_length - data_length)
                      null_index = requested - 1
                      requested = max_length
  
              elif null_index % 2 == 0:
                  null_index >>= 1
                  break
  
          # convert selected part of the string to unicode
          uchrs = struct.unpack('<{:d}H'.format(null_index), data[:null_index * 2])
          s = u''.join(map(chr, uchrs))
  
          if encoding:
              return b(s.encode(encoding, 'backslashreplace_'))
  
          return b(s.encode('utf-8', 'backslashreplace_'))
docs: Get an Unicode string located at the given address.