def host_create(host, groups, interfaces, **connection_args):
 conn_args = _login(**connection_args)
 try:
  if conn_args:
   method = 'host.create'
   params = {'host': host}
   if (not isinstance(groups, list)):
    groups = [groups]
   grps = []
   for group in groups:
    grps.append({'groupid': group})
   params['groups'] = grps
   if (not isinstance(interfaces, list)):
    interfaces = [interfaces]
   params['interfaces'] = interfaces
   params = _params_extend(params, _ignore_name=True, **connection_args)
   ret = _query(method, params, conn_args['url'], conn_args['auth'])
   return ret['result']['hostids']
  else:
   raise KeyError
 except KeyError:
  return ret

def host_create ( host , groups , interfaces , ** connection_args ) : conn_args = _login ( ** connection_args ) try : if conn_args : method = 'host.create' params = { 'host' : host } if ( not isinstance ( groups , list ) ) : groups = [ groups ] grps = [ ] for group in groups : grps . append ( { 'groupid' : group } ) params [ 'groups' ] = grps if ( not isinstance ( interfaces , list ) ) : interfaces = [ interfaces ] params [ 'interfaces' ] = interfaces params = _params_extend ( params , _ignore_name = True , ** connection_args ) ret = _query ( method , params , conn_args [ 'url' ] , conn_args [ 'auth' ] ) return ret [ 'result' ] [ 'hostids' ] else : raise KeyError except KeyError : return ret
create new host .