def parse(args=None):
parser = argparse.ArgumentParser(description='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', dest='<STR_LIT:user>', default='<STR_LIT>', help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', dest='<STR_LIT:key>', default='<STR_LIT>', help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT:-c>', '<STR_LIT>', dest='<STR_LIT>', default=os.path.expanduser('<STR_LIT>'),<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', dest='<STR_LIT>', action='<STR_LIT:store_true>', default=False,<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', dest='<STR_LIT>', choices=['<STR_LIT:list>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:html>'], default='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', dest='<STR_LIT>', type=argparse.FileType('<STR_LIT>'), default=sys.stdout,<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', '<STR_LIT>', action='<STR_LIT:version>', version='<STR_LIT>'.format(version))<EOL>parser.add_argument('<STR_LIT>', dest='<STR_LIT>', action='<STR_LIT>', default=True,<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', dest='<STR_LIT>', action='<STR_LIT>', default=True,<EOL>help='<STR_LIT>')<EOL>subparsers = parser.add_subparsers(help='<STR_LIT>',<EOL>dest='<STR_LIT>')<EOL>subparsers.required = True<EOL>for api_call in API_CALLS:<EOL><INDENT>api_method = getattr(API, api_call)<EOL>subparser = subparsers.add_parser(api_call, help=api_method.__name__)<EOL>spec = inspect.getargspec(api_method)<EOL>for argument_name, default in reversed(list(zip_longest(reversed(spec.args or []),<EOL>reversed(spec.defaults or []), fillvalue='<STR_LIT>'))):<EOL><INDENT>if argument_name == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>elif default == '<STR_LIT>':<EOL><INDENT>subparser.add_argument(argument_name)<EOL><DEDENT>else:<EOL><INDENT>subparser.add_argument('<STR_LIT>'.format(argument_name.replace('<STR_LIT:_>', '<STR_LIT:->')), dest=argument_name,<EOL>default=default, nargs='<STR_LIT:*>')<EOL><DEDENT><DEDENT><DEDENT>arguments = vars(parser.parse_args(args) if args else parser.parse_args())<EOL>if not arguments.get('<STR_LIT:user>', None) or not arguments.get('<STR_LIT:key>', None):<EOL><INDENT>try:<EOL><INDENT>with open(arguments.pop('<STR_LIT>')) as credentials:<EOL><INDENT>arguments['<STR_LIT:user>'], arguments['<STR_LIT:key>'] = credentials.readline().strip(), credentials.readline().strip()<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>for key, value in arguments.items():<EOL><INDENT>if value in ('<STR_LIT:->', ['<STR_LIT:->']):<EOL><INDENT>arguments[key] == (line.strip() for line in sys.stdin.readlines())<EOL><DEDENT>elif value == []:<EOL><INDENT>arguments[key] = True<EOL><DEDENT>elif type(value) == list and len(value) == <NUM_LIT:1>:<EOL><INDENT>arguments[key] = value[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return (arguments.pop('<STR_LIT>'), arguments.pop('<STR_LIT>'), arguments)<EOL>
Defines how to parse CLI arguments for the DomainTools API