def _parse_and_output(filename, args):
relpath = os.path.dirname(filename)<EOL>if os.path.isfile(filename):<EOL><INDENT>calls = _parse_file(filename, relpath)<EOL><DEDENT>elif os.path.isdir(filename):<EOL><INDENT>calls = _parse_dir(filename, relpath)<EOL><DEDENT>else:<EOL><INDENT>_error("<STR_LIT>", filename)<EOL><DEDENT>if not calls:<EOL><INDENT>_error("<STR_LIT>")<EOL><DEDENT>if args.load_configs:<EOL><INDENT>keys = set()<EOL>for call in calls:<EOL><INDENT>keys.add(call.key)<EOL><DEDENT>conf = pyconfig.Config()<EOL>for key, value in conf.settings.items():<EOL><INDENT>if key in keys:<EOL><INDENT>continue<EOL><DEDENT>calls.append(_PyconfigCall('<STR_LIT>', key, value, [None]*<NUM_LIT:4>))<EOL><DEDENT><DEDENT>_output(calls, args)<EOL>
Parse `filename` appropriately and then output calls according to the
`args` specified.

:param filename: A file or directory
:param args: Command arguments
:type filename: str