def call_xenhost(session, method, arg_dict):
 try:
  result = session.call_plugin('xenhost.py', method, args=arg_dict)
  if (not result):
   return ''
  return jsonutils.loads(result)
 except ValueError:
  LOG.exception(_LE('Unable to get updated status'))
  return None
 except session.XenAPI.Failure as e:
  LOG.error(_LE('The call to %(method)s returned an error: %(e)s.'), {'method': method, 'e': e})
  return e.details[1]

def call_xenhost ( session , method , arg_dict ) : try : result = session . call_plugin ( 'xenhost.py' , method , args = arg_dict ) if ( not result ) : return '' return jsonutils . loads ( result ) except ValueError : LOG . exception ( _LE ( 'Unable to get updated status' ) ) return None except session . XenAPI . Failure as e : LOG . error ( _LE ( 'The call to %(method)s returned an error: %(e)s.' ) , { 'method' : method , 'e' : e } ) return e . details [ 1 ]
there will be several methods that will need this general handling for interacting with the xenhost plugin .