def _toledo8217StatusParse(status):
 (weight, weight_info) = (None, None)
 stat = ord(status[(status.index('?') + 1)])
 if (stat == 0):
  weight_info = 'ok'
 else:
  weight_info = []
  if (stat & 1):
   weight_info.append('moving')
  if (stat & (1 << 1)):
   weight_info.append('over_capacity')
  if (stat & (1 << 2)):
   weight_info.append('negative')
   weight = 0.0
  if (stat & (1 << 3)):
   weight_info.append('outside_zero_capture_range')
  if (stat & (1 << 4)):
   weight_info.append('center_of_zero')
  if (stat & (1 << 5)):
   weight_info.append('net_weight')
 return (weight, weight_info)

def _toledo8217StatusParse ( status ) : ( weight , weight_info ) = ( None , None ) stat = ord ( status [ ( status . index ( '?' ) + 1 ) ] ) if ( stat == 0 ) : weight_info = 'ok' else : weight_info = [ ] if ( stat & 1 ) : weight_info . append ( 'moving' ) if ( stat & ( 1 << 1 ) ) : weight_info . append ( 'over_capacity' ) if ( stat & ( 1 << 2 ) ) : weight_info . append ( 'negative' ) weight = 0.0 if ( stat & ( 1 << 3 ) ) : weight_info . append ( 'outside_zero_capture_range' ) if ( stat & ( 1 << 4 ) ) : weight_info . append ( 'center_of_zero' ) if ( stat & ( 1 << 5 ) ) : weight_info . append ( 'net_weight' ) return ( weight , weight_info )
parse a scales status .