def validate_exists(args, key, default=None):
 if (key in args):
  if (len(args[key]) == 0):
   raise ArgumentError((_('Argument %(key)s value %(value)s is too short.') % {'key': key, 'value': args[key]}))
  if (not ARGUMENT_PATTERN.match(args[key])):
   raise ArgumentError((_('Argument %(key)s value %(value)s contains invalid characters.') % {'key': key, 'value': args[key]}))
  if (args[key][0] == '-'):
   raise ArgumentError((_('Argument %(key)s value %(value)s starts with a hyphen.') % {'key': key, 'value': args[key]}))
  return args[key]
 elif (default is not None):
  return default
 else:
  raise ArgumentError((_('Argument %s is required.') % key))

def validate_exists ( args , key , default = None ) : if ( key in args ) : if ( len ( args [ key ] ) == 0 ) : raise ArgumentError ( ( _ ( 'Argument %(key)s value %(value)s is too short.' ) % { 'key' : key , 'value' : args [ key ] } ) ) if ( not ARGUMENT_PATTERN . match ( args [ key ] ) ) : raise ArgumentError ( ( _ ( 'Argument %(key)s value %(value)s contains invalid characters.' ) % { 'key' : key , 'value' : args [ key ] } ) ) if ( args [ key ] [ 0 ] == '-' ) : raise ArgumentError ( ( _ ( 'Argument %(key)s value %(value)s starts with a hyphen.' ) % { 'key' : key , 'value' : args [ key ] } ) ) return args [ key ] elif ( default is not None ) : return default else : raise ArgumentError ( ( _ ( 'Argument %s is required.' ) % key ) )
validates that a string argument to a rpc method call is given .