def _check_users(users):
 messg = ''
 valid = True
 for (user, user_details) in six.iteritems(users):
  if (not user_details):
   valid = False
   messg += 'Please provide details for username {user}.\n'.format(user=user)
   continue
  if (not (isinstance(user_details.get('level'), int) or (0 <= user_details.get('level') <= 15))):
   messg += 'Level must be a integer between 0 and 15 for username {user}. Will assume 0.\n'.format(user=user)
 return (valid, messg)

def _check_users ( users ) : messg = '' valid = True for ( user , user_details ) in six . iteritems ( users ) : if ( not user_details ) : valid = False messg += 'Please provide details for username {user}.\n' . format ( user = user ) continue if ( not ( isinstance ( user_details . get ( 'level' ) , int ) or ( 0 <= user_details . get ( 'level' ) <= 15 ) ) ) : messg += 'Level must be a integer between 0 and 15 for username {user}. Will assume 0.\n' . format ( user = user ) return ( valid , messg )
checks if the input dictionary of users is valid .