code: def add_data(self, minimum_address, maximum_address, data, overwrite):
          
  
          if minimum_address == self.maximum_address:
              self.maximum_address = maximum_address
              self.data += data
          elif maximum_address == self.minimum_address:
              self.minimum_address = minimum_address
              self.data = data + self.data
          elif (overwrite
                and minimum_address < self.maximum_address
                and maximum_address > self.minimum_address):
              self_data_offset = minimum_address - self.minimum_address
  
              # Prepend data.
              if self_data_offset < 0:
                  self_data_offset *= -1
                  self.data = data[:self_data_offset] + self.data
                  del data[:self_data_offset]
                  self.minimum_address = minimum_address
  
              # Overwrite overlapping part.
              self_data_left = len(self.data) - self_data_offset
  
              if len(data) <= self_data_left:
                  self.data[self_data_offset:self_data_offset + len(data)] = data
                  data = bytearray()
              else:
                  self.data[self_data_offset:] = data[:self_data_left]
                  data = data[self_data_left:]
  
              # Append data.
              if len(data) > 0:
                  self.data += data
                  self.maximum_address = maximum_address
          else:
              raise AddDataError(
                  'data added to a segment must be adjacent to or overlapping '
                  'with the original segment data')
docs: Add given data to this segment. The added data must be adjacent to
          the current segment data, otherwise an exception is thrown.