def get_retcode(ret):
 retcode = 0
 if (isinstance(ret, dict) and (ret.get('retcode', 0) != 0)):
  return ret['retcode']
 elif (isinstance(ret, bool) and (not ret)):
  return 1
 return retcode

def get_retcode ( ret ) : retcode = 0 if ( isinstance ( ret , dict ) and ( ret . get ( 'retcode' , 0 ) != 0 ) ) : return ret [ 'retcode' ] elif ( isinstance ( ret , bool ) and ( not ret ) ) : return 1 return retcode
determine a retcode for a given return .