code: def _parse_record_line(record_line):
      
      # Dictionary for record fields
      record_fields = {}
  
      # Read string fields from record line
      (record_fields['record_name'], record_fields['n_seg'],
       record_fields['n_sig'], record_fields['fs'],
       record_fields['counter_freq'], record_fields['base_counter'],
       record_fields['sig_len'], record_fields['base_time'],
       record_fields['base_date']) = re.findall(_rx_record, record_line)[0]
  
      for field in RECORD_SPECS.index:
          # Replace empty strings with their read defaults (which are
          # mostly None)
          if record_fields[field] == '':
              record_fields[field] = RECORD_SPECS.loc[field, 'read_default']
          # Typecast non-empty strings for non-string (numerical/datetime)
          # fields
          else:
              if RECORD_SPECS.loc[field, 'allowed_types'] == int_types:
                  record_fields[field] = int(record_fields[field])
              elif RECORD_SPECS.loc[field, 'allowed_types'] == float_types:
                  record_fields[field] = float(record_fields[field])
                  # cast fs to an int if it is close
                  if field == 'fs':
                      fs = float(record_fields['fs'])
                      if round(fs, 8) == float(int(fs)):
                          fs = int(fs)
                      record_fields['fs'] = fs
              elif field == 'base_time':
                  record_fields['base_time'] = wfdb_strptime(record_fields['base_time'])
              elif field == 'base_date':
                  record_fields['base_date'] = datetime.datetime.strptime(
                      record_fields['base_date'], '%d/%m/%Y').date()
  
      # This is not a standard wfdb field, but is useful to set.
      if record_fields['base_date'] and record_fields['base_time']:
          record_fields['base_datetime'] = datetime.datetime.combine(
              record_fields['base_date'], record_fields['base_time'])
  
      return record_fields
docs: Extract fields from a record line string into a dictionary