code: def _parse_record(data, duration_format='seconds'):
      
  
      def _map_duration(s):
          if s == '':
              return None
          elif duration_format.lower() == 'seconds':
              return int(s)
          else:
              t = time.strptime(s, duration_format)
              return 3600 * t.tm_hour + 60 * t.tm_min + t.tm_sec
  
      def _map_position(data):
          antenna = Position()
  
          if 'antenna_id' in data and data['antenna_id']:
              antenna.antenna = data['antenna_id']
  
          if 'place_id' in data:
              raise NameError("Use field name 'antenna_id' in input files. "
                              "'place_id' is deprecated.")
  
          if 'latitude' in data and 'longitude' in data:
              latitude = data['latitude']
              longitude = data['longitude']
              # latitude and longitude should not be empty strings.
              if latitude and longitude:
                  antenna.location = float(latitude), float(longitude)
  
          return antenna
  
      return Record(interaction=data['interaction'] if data['interaction'] else None,
                    direction=data['direction'],
                    correspondent_id=data['correspondent_id'],
                    datetime=_tryto(
                        lambda x: datetime.strptime(x, "%Y-%m-%d %H:%M:%S"),
                        data['datetime']),
                    call_duration=_tryto(_map_duration, data['call_duration']),
                    position=_tryto(_map_position, data))
docs: Parse a raw data dictionary and return a Record object.