def _parse_tag_data(elem_code, elem_num, raw_data):
 if (elem_code in _BYTEFMT):
  if (elem_num == 1):
   num = ''
  else:
   num = str(elem_num)
  fmt = (('>' + num) + _BYTEFMT[elem_code])
  assert (len(raw_data) == struct.calcsize(fmt))
  data = struct.unpack(fmt, raw_data)
  if ((elem_code not in [10, 11]) and (len(data) == 1)):
   data = data[0]
  if (elem_code == 2):
   return _bytes_to_string(data)
  elif (elem_code == 10):
   return str(datetime.date(*data))
  elif (elem_code == 11):
   return str(datetime.time(*data[:3]))
  elif (elem_code == 13):
   return bool(data)
  elif (elem_code == 18):
   return _bytes_to_string(data[1:])
  elif (elem_code == 19):
   return _bytes_to_string(data[:(-1)])
  else:
   return data
 else:
  return None

def _parse_tag_data ( elem_code , elem_num , raw_data ) : if ( elem_code in _BYTEFMT ) : if ( elem_num == 1 ) : num = '' else : num = str ( elem_num ) fmt = ( ( '>' + num ) + _BYTEFMT [ elem_code ] ) assert ( len ( raw_data ) == struct . calcsize ( fmt ) ) data = struct . unpack ( fmt , raw_data ) if ( ( elem_code not in [ 10 , 11 ] ) and ( len ( data ) == 1 ) ) : data = data [ 0 ] if ( elem_code == 2 ) : return _bytes_to_string ( data ) elif ( elem_code == 10 ) : return str ( datetime . date ( * data ) ) elif ( elem_code == 11 ) : return str ( datetime . time ( * data [ : 3 ] ) ) elif ( elem_code == 13 ) : return bool ( data ) elif ( elem_code == 18 ) : return _bytes_to_string ( data [ 1 : ] ) elif ( elem_code == 19 ) : return _bytes_to_string ( data [ : ( - 1 ) ] ) else : return data else : return None
returns single data value .