def create_parser():
    codes = network_codes()
    EPILOG = (('Files are binary by default unless they end with the suffix ".hex". ' + 'Known networks codes:\n  ') + ', '.join([('%s (%s)' % (i, full_network_name_for_netcode(i))) for i in codes]))
    parser = argparse.ArgumentParser(description='Manipulate bitcoin (or alt coin) transactions.', epilog=EPILOG)
    parser.add_argument('-t', '--transaction-version', type=range_int(0, 255, 'version'), help='Transaction version, either 1 (default) or 3 (not yet supported).')
    parser.add_argument('-l', '--lock-time', type=parse_locktime, help='Lock time; either a blockindex, or a date/time (example: "2014-01-01T15:00:00"')
    parser.add_argument('-n', '--network', default=get_current_netcode(), choices=codes, help='Define network code (BTC=Bitcoin mainnet, XTN=Bitcoin testnet).')
    parser.add_argument('-a', '--augment', action='store_true', help='augment tx by adding any missing spendable metadata by fetching inputs from cache and/or web services')
    parser.add_argument('-s', '--verbose-signature', action='store_true', help='Display technical signature details.')
    parser.add_argument('-i', '--fetch-spendables', metavar='address', action='append', help='Add all unspent spendables for the given bitcoin address. This information is fetched from web services. With no outputs, incoming spendables will be printed.')
    parser.add_argument('-f', '--private-key-file', metavar='path-to-private-keys', action='append', default=[], help='file containing WIF or BIP0032 private keys. If file name ends with .gpg, "gpg -d" will be invoked automatically. File is read one line at a time, and if the file contains only one WIF per line, it will also be scanned for a bitcoin address, and any addresses found will be assumed to be public keys for the given private key.', type=argparse.FileType('r'))
    parser.add_argument('-g', '--gpg-argument', help='argument to pass to gpg (besides -d).', default='')
    parser.add_argument('--remove-tx-in', metavar='tx_in_index_to_delete', action='append', type=int, help='remove a tx_in')
    parser.add_argument('--remove-tx-out', metavar='tx_out_index_to_delete', action='append', type=int, help='remove a tx_out')
    parser.add_argument('-F', '--fee', help='fee, in satoshis, to pay on transaction, or "standard" to auto-calculate. This is only useful if the "split pool" is used; otherwise, the fee is automatically set to the unclaimed funds.', default='standard', metavar='transaction-fee', type=parse_fee)
    (parser.add_argument('-C', '--cache', help='force the resultant transaction into the transaction cache. Mostly for testing.', action='store_true'),)
    (parser.add_argument('--db', type=Tx.from_hex, help='force the transaction expressed by the given hex into a RAM-based transaction cache. Mostly for testing.', action='append'),)
    parser.add_argument('-u', '--show-unspents', action='store_true', help='show TxOut items for this transaction in Spendable form.')
    parser.add_argument('-b', '--bitcoind-url', help='URL to bitcoind instance to validate against (http://user:pass@host:port).')
    parser.add_argument('-o', '--output-file', metavar='path-to-output-file', type=argparse.FileType('wb'), help='file to write transaction to. This supresses most other output.')
    parser.add_argument('-d', '--disassemble', action='store_true', help='Disassemble scripts.')
    parser.add_argument('--pdb', action='store_true', help='Enter PDB debugger on each script instruction.')
    parser.add_argument('--trace', action='store_true', help='Trace scripts.')
    parser.add_argument('-p', '--pay-to-script', metavar='pay-to-script', action='append', help='a hex version of a script required for a pay-to-scriptinput (a bitcoin address that starts with 3)')
    parser.add_argument('-P', '--pay-to-script-file', metavar='pay-to-script-file', nargs=1, type=argparse.FileType('r'), help='a file containing hex scripts (one per line) corresponding to pay-to-script inputs')
    parser.add_argument('argument', nargs='*', help='generic argument: can be a hex transaction id (exactly 64 characters) to be fetched from cache or a web service; a transaction as a hex string; a path name to a transaction to be loaded; a spendable 4-tuple of the form tx_id/tx_out_idx/script_hex/satoshi_count to be added to TxIn list; an address/satoshi_count to be added to the TxOut list; an address to be added to the TxOut list and placed in the "split pool".')
    return parser
def create_parser():
    codes = network_codes()
    EPILOG = (('Files are binary by default unless they end with the suffix ".hex". ' + 'Known networks codes:\n  ') + ', '.join([('%s (%s)' % (i, full_network_name_for_netcode(i))) for i in codes]))
    parser = argparse.ArgumentParser(description='Manipulate bitcoin (or alt coin) transactions.', epilog=EPILOG)
    parser.add_argument('-t', '--transaction-version', type=range_int(0, 255, 'version'), help='Transaction version, either 1 (default) or 3 (not yet supported).')
    parser.add_argument('-l', '--lock-time', type=parse_locktime, help='Lock time; either a blockindex, or a date/time (example: "2014-01-01T15:00:00"')
    parser.add_argument('-n', '--network', default=get_current_netcode(), choices=codes, help='Define network code (BTC=Bitcoin mainnet, XTN=Bitcoin testnet).')
    parser.add_argument('-a', '--augment', action='store_true', help='augment tx by adding any missing spendable metadata by fetching inputs from cache and/or web services')
    parser.add_argument('-s', '--verbose-signature', action='store_true', help='Display technical signature details.')
    parser.add_argument('-i', '--fetch-spendables', metavar='address', action='append', help='Add all unspent spendables for the given bitcoin address. This information is fetched from web services. With no outputs, incoming spendables will be printed.')
    parser.add_argument('-f', '--private-key-file', metavar='path-to-private-keys', action='append', default=[], help='file containing WIF or BIP0032 private keys. If file name ends with .gpg, "gpg -d" will be invoked automatically. File is read one line at a time, and if the file contains only one WIF per line, it will also be scanned for a bitcoin address, and any addresses found will be assumed to be public keys for the given private key.', type=argparse.FileType('r'))
    parser.add_argument('-g', '--gpg-argument', help='argument to pass to gpg (besides -d).', default=)
    parser.add_argument('--remove-tx-in', metavar='tx_in_index_to_delete', action='append', type=int, help='remove a tx_in')
    parser.add_argument('--remove-tx-out', metavar='tx_out_index_to_delete', action='append', type=int, help='remove a tx_out')
    parser.add_argument('-F', '--fee', help='fee, in satoshis, to pay on transaction, or "standard" to auto-calculate. This is only useful if the "split pool" is used; otherwise, the fee is automatically set to the unclaimed funds.', default='standard', metavar='transaction-fee', type=parse_fee)
    (parser.add_argument('-C', '--cache', help='force the resultant transaction into the transaction cache. Mostly for testing.', action='store_true'),)
    (parser.add_argument('--db', type=Tx.from_hex, help='force the transaction expressed by the given hex into a RAM-based transaction cache. Mostly for testing.', action='append'),)
    parser.add_argument('-u', '--show-unspents', action='store_true', help='show TxOut items for this transaction in Spendable form.')
    parser.add_argument('-b', '--bitcoind-url', help='URL to bitcoind instance to validate against (http://user:pass@host:port).')
    parser.add_argument('-o', '--output-file', metavar='path-to-output-file', type=argparse.FileType('wb'), help='file to write transaction to. This supresses most other output.')
    parser.add_argument('-d', '--disassemble', action='store_true', help='Disassemble scripts.')
    parser.add_argument('--pdb', action='store_true', help='Enter PDB debugger on each script instruction.')
    parser.add_argument('--trace', action='store_true', help='Trace scripts.')
    parser.add_argument('-p', '--pay-to-script', metavar='pay-to-script', action='append', help='a hex version of a script required for a pay-to-scriptinput (a bitcoin address that starts with 3)')
    parser.add_argument('-P', '--pay-to-script-file', metavar='pay-to-script-file', nargs=1, type=argparse.FileType('r'), help='a file containing hex scripts (one per line) corresponding to pay-to-script inputs')
    parser.add_argument('argument', nargs='*', help='generic argument: can be a hex transaction id (exactly 64 characters) to be fetched from cache or a web service; a transaction as a hex string; a path name to a transaction to be loaded; a spendable 4-tuple of the form tx_id/tx_out_idx/script_hex/satoshi_count to be added to TxIn list; an address/satoshi_count to be added to the TxOut list; an address to be added to the TxOut list and placed in the "split pool".')
    return parser