def parse_snmp_return(ret, is_bulk=False):
 err = True
 (errIndication, errStatus, errIdx, varBinds) = ret
 if errIndication:
  data = errIndication
 elif errStatus:
  if is_bulk:
   varBinds = varBinds[(-1)]
  data = ('%s at %s' % (errStatus.prettyPrint(), ((errIdx and varBinds[(int(errIdx) - 1)]) or '?')))
 else:
  err = False
  data = varBinds
 return (err, data)

def parse_snmp_return ( ret , is_bulk = False ) : err = True ( errIndication , errStatus , errIdx , varBinds ) = ret if errIndication : data = errIndication elif errStatus : if is_bulk : varBinds = varBinds [ ( - 1 ) ] data = ( '%s at %s' % ( errStatus . prettyPrint ( ) , ( ( errIdx and varBinds [ ( int ( errIdx ) - 1 ) ] ) or '?' ) ) ) else : err = False data = varBinds return ( err , data )
check the return value of snmp operations .