def parse_commands(module):
 for cmd in module.params['commands']:
  if isinstance(cmd, basestring):
   cmd = dict(command=cmd, output=None)
  elif ('command' not in cmd):
   module.fail_json(msg='command keyword argument is required')
  elif (cmd.get('output') not in [None, 'text', 'json']):
   module.fail_json(msg='invalid output specified for command')
  elif (not set(cmd.keys()).issubset(VALID_KEYS)):
   module.fail_json(msg='unknown keyword specified')
  (yield cmd)

def parse_commands ( module ) : for cmd in module . params [ 'commands' ] : if isinstance ( cmd , basestring ) : cmd = dict ( command = cmd , output = None ) elif ( 'command' not in cmd ) : module . fail_json ( msg = 'command keyword argument is required' ) elif ( cmd . get ( 'output' ) not in [ None , 'text' , 'json' ] ) : module . fail_json ( msg = 'invalid output specified for command' ) elif ( not set ( cmd . keys ( ) ) . issubset ( VALID_KEYS ) ) : module . fail_json ( msg = 'unknown keyword specified' ) ( yield cmd )
parse commands .