docs: def as_srec(self, number_of_data_bytes=32, address_length_bits=32):
          """Format the binary file as Motorola S-Records records and return
          them as a string.
  
          `number_of_data_bytes` is the number of data bytes in each
          record.
  
          `address_length_bits` is the number of address bits in each
          record.
  
          >>> print(binfile.as_srec())
          S32500000100214601360121470136007EFE09D219012146017E17C20001FF5F16002148011973
          S32500000120194E79234623965778239EDA3F01B2CA3F0156702B5E712B722B73214601342199
          S5030002FA
  
          """
  
          header = []
  
          if self._header is not None:
              record = pack_srec('0', 0, len(self._header), self._header)
              header.append(record)
  
          type_ = str((address_length_bits // 8) - 1)
  
          if type_ not in '123':
              raise Error("expected data record type 1..3, but got {}".format(
                  type_))
  
          data = [pack_srec(type_, address, len(data), data)
                  for address, data in self._segments.chunks(number_of_data_bytes)]
          number_of_records = len(data)
  
          if number_of_records <= 0xffff:
              footer = [pack_srec('5', number_of_records, 0, None)]
          elif number_of_records <= 0xffffff:
              footer = [pack_srec('6', number_of_records, 0, None)]
          else:
              raise Error('too many records {}'.format(number_of_records))
  
          # Add the execution start address.
          if self.execution_start_address is not None:
              if type_ == '1':
                  record = pack_srec('9', self.execution_start_address, 0, None)
              elif type_ == '2':
                  record = pack_srec('8', self.execution_start_address, 0, None)
              else:
                  record = pack_srec('7', self.execution_start_address, 0, None)
  
              footer.append(record)
  
          return '\n'.join(header + data + footer) + '\n'