def _check_dsmc_output(output, check_attrs, exact_match=True):
 parsed_attrs = {}
 for line in output.split('\n'):
  (key, sep, val) = line.partition(':')
  if ((sep is not None) and (key is not None) and (len(val.strip()) > 0)):
   parsed_attrs[key] = val.strip()
 for (ckey, cval) in check_attrs.items():
  if (ckey not in parsed_attrs):
   return False
  elif (exact_match and (parsed_attrs[ckey] != cval)):
   return False
  elif ((not exact_match) and (int(parsed_attrs[ckey]) < int(cval))):
   return False
 return True

def _check_dsmc_output ( output , check_attrs , exact_match = True ) : parsed_attrs = { } for line in output . split ( '\n' ) : ( key , sep , val ) = line . partition ( ':' ) if ( ( sep is not None ) and ( key is not None ) and ( len ( val . strip ( ) ) > 0 ) ) : parsed_attrs [ key ] = val . strip ( ) for ( ckey , cval ) in check_attrs . items ( ) : if ( ckey not in parsed_attrs ) : return False elif ( exact_match and ( parsed_attrs [ ckey ] != cval ) ) : return False elif ( ( not exact_match ) and ( int ( parsed_attrs [ ckey ] ) < int ( cval ) ) ) : return False return True
check dsmc command line utility output .