def main_bigg(args=None, urlopen=urlopen):
parser = argparse.ArgumentParser(<EOL>description='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', metavar='<STR_LIT:path>', default='<STR_LIT:.>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help=('<STR_LIT>'<EOL>'<STR_LIT>'))<EOL>parser.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help=('<STR_LIT>'<EOL>'<STR_LIT>'))<EOL>parser.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>parser.add_argument('<STR_LIT:id>', help='<STR_LIT>')<EOL>args = parser.parse_args(args)<EOL>if '<STR_LIT>' in os.environ:<EOL><INDENT>level = getattr(logging, os.environ['<STR_LIT>'].upper(), None)<EOL>if level is not None:<EOL><INDENT>logging.basicConfig(level=level)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logging.basicConfig(<EOL>level=logging.INFO, format='<STR_LIT>')<EOL><DEDENT>if args.id == '<STR_LIT:list>':<EOL><INDENT>print('<STR_LIT>')<EOL>f = urlopen('<STR_LIT>')<EOL>doc = json.loads(f.read().decode('<STR_LIT:utf-8>'))<EOL>results = doc['<STR_LIT>']<EOL>id_width = min(max(len(result['<STR_LIT>']) for result in results), <NUM_LIT:16>)<EOL>for result in sorted(results, key=lambda x: x.get('<STR_LIT>')):<EOL><INDENT>print('<STR_LIT>'.format(<EOL>result.get('<STR_LIT>').ljust(id_width), result.get('<STR_LIT>')))<EOL><DEDENT>return <NUM_LIT:0><EOL><DEDENT>importer_entry = None<EOL>try:<EOL><INDENT>importer_entry = next(<EOL>pkg_resources.iter_entry_points('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>except StopIteration:<EOL><INDENT>logger.error('<STR_LIT>')<EOL>sys.exit(-<NUM_LIT:1>)<EOL><DEDENT>importer_class = importer_entry.load()<EOL>importer = importer_class()<EOL>try:<EOL><INDENT>f = urlopen(<EOL>'<STR_LIT>'.format(<EOL>url_quote(args.id)))<EOL>model = importer.import_model(codecs.getreader('<STR_LIT:utf-8>')(f))<EOL><DEDENT>except ModelLoadError as e:<EOL><INDENT>logger.error('<STR_LIT>', exc_info=True)<EOL>importer.help()<EOL>parser.error(text_type(e))<EOL><DEDENT>except ParseError as e:<EOL><INDENT>logger.error('<STR_LIT>', exc_info=True)<EOL>logger.error(text_type(e))<EOL>sys.exit(-<NUM_LIT:1>)<EOL><DEDENT>if args.merge_compounds:<EOL><INDENT>compounds_before = len(model.compounds)<EOL>sbml.merge_equivalent_compounds(model)<EOL>if len(model.compounds) < compounds_before:<EOL><INDENT>logger.info(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>compounds_before, len(model.compounds)))<EOL><DEDENT><DEDENT>print('<STR_LIT>'.format(model.name))<EOL>print('<STR_LIT>'.format(model.biomass_reaction))<EOL>print('<STR_LIT>'.format(len(model.compartments)))<EOL>print('<STR_LIT>'.format(len(model.compounds)))<EOL>print('<STR_LIT>'.format(len(model.reactions)))<EOL>print('<STR_LIT>'.format(count_genes(model)))<EOL>dest_is_empty = False<EOL>try:<EOL><INDENT>dest_is_empty = len(os.listdir(args.dest)) == <NUM_LIT:0><EOL><DEDENT>except OSError:<EOL><INDENT>dest_is_empty = True<EOL><DEDENT>if not dest_is_empty:<EOL><INDENT>if not args.force:<EOL><INDENT>logger.error('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(args.dest))<EOL>return <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>logger.warning('<STR_LIT>'<EOL>'<STR_LIT>'.format(args.dest))<EOL><DEDENT><DEDENT>dest = args.dest<EOL>mkdir_p(dest)<EOL>convert_exchange = not args.no_exchange<EOL>write_yaml_model(model, dest, convert_exchange=convert_exchange,<EOL>split_subsystem=args.split_subsystem)<EOL>
Entry point for BiGG import program.

    If the ``args`` are provided, these should be a list of strings that will
    be used instead of ``sys.argv[1:]``. This is mostly useful for testing.