def validate_args(args):
logging.basicConfig(level=getattr(logging, args.log_level.upper()))<EOL>if getattr(args, '<STR_LIT>', None) == '<STR_LIT>':<EOL><INDENT>if args.requirements_file and not args.requirements_file.isfile():<EOL><INDENT>print(('<STR_LIT>'<EOL>.format(args.requirements_file)), file=sys.stderr)<EOL>raise SystemExit(-<NUM_LIT:1>)<EOL><DEDENT>elif not args.plugin and not args.requirements_file:<EOL><INDENT>print(('<STR_LIT>'<EOL>'<STR_LIT>'), file=sys.stderr)<EOL>raise SystemExit(-<NUM_LIT:2>)<EOL><DEDENT><DEDENT>if hasattr(args, '<STR_LIT>'):<EOL><INDENT>logger.debug('<STR_LIT>', args.server_url)<EOL>args.server_url = SERVER_URL_TEMPLATE % args.server_url<EOL><DEDENT>if all([args.plugins_directory is None,<EOL>args.config_file is None]):<EOL><INDENT>args.plugins_directory = get_plugins_directory()<EOL><DEDENT>elif args.plugins_directory is None:<EOL><INDENT>args.config_file = args.config_file.realpath()<EOL>args.plugins_directory = get_plugins_directory(config_path=<EOL>args.config_file)<EOL><DEDENT>else:<EOL><INDENT>args.plugins_directory = args.plugins_directory.realpath()<EOL><DEDENT>return args<EOL>
Apply custom validation and actions based on parsed arguments.

Parameters
----------
args : argparse.Namespace
    Result from ``parse_args`` method of ``argparse.ArgumentParser``
    instance.

Returns
-------
argparse.Namespace
    Reference to input ``args``, which have been validated/updated.