def user_addmedia(userids, active, mediatypeid, period, sendto, severity, **connection_args):
 conn_args = _login(**connection_args)
 try:
  if conn_args:
   method = 'user.addmedia'
   params = {'users': []}
   if (not isinstance(userids, list)):
    userids = [userids]
   for user in userids:
    params['users'].append({'userid': user})
   params['medias'] = [{'active': active, 'mediatypeid': mediatypeid, 'period': period, 'sendto': sendto, 'severity': severity}]
   ret = _query(method, params, conn_args['url'], conn_args['auth'])
   return ret['result']['mediaids']
  else:
   raise KeyError
 except KeyError:
  return ret

def user_addmedia ( userids , active , mediatypeid , period , sendto , severity , ** connection_args ) : conn_args = _login ( ** connection_args ) try : if conn_args : method = 'user.addmedia' params = { 'users' : [ ] } if ( not isinstance ( userids , list ) ) : userids = [ userids ] for user in userids : params [ 'users' ] . append ( { 'userid' : user } ) params [ 'medias' ] = [ { 'active' : active , 'mediatypeid' : mediatypeid , 'period' : period , 'sendto' : sendto , 'severity' : severity } ] ret = _query ( method , params , conn_args [ 'url' ] , conn_args [ 'auth' ] ) return ret [ 'result' ] [ 'mediaids' ] else : raise KeyError except KeyError : return ret
add new media to multiple users .