def format_crypto_units(input_quantity, input_type, output_type, coin_symbol=None, print_cs=False, safe_trimming=False, round_digits=0):
    assert input_type in UNIT_CHOICES, input_type
    assert output_type in UNIT_CHOICES, output_type
    if print_cs:
        assert is_valid_coin_symbol(coin_symbol=coin_symbol), coin_symbol
    assert type(round_digits) is int

    satoshis_float = to_satoshis(input_quantity=input_quantity, input_type=input_type)

    if round_digits:
        satoshis_float = round(satoshis_float, -1*round_digits)

    output_quantity = from_satoshis(
            input_satoshis=satoshis_float,
            output_type=output_type,
            )

    if output_type == 'bit' and round_digits >= 2:
        pass
        # hack to add thousands separator with no decimals
        output_quantity_formatted = format_output(num=output_quantity, output_type='satoshi')
    else:
        # add thousands separator and appropriate # of decimals
        output_quantity_formatted = format_output(num=output_quantity, output_type=output_type)

    if safe_trimming and output_type not in ('satoshi', 'bit'):
        output_quantity_formatted = safe_trim(qty_as_string=output_quantity_formatted)

    if print_cs:
        curr_symbol = get_curr_symbol(
                coin_symbol=coin_symbol,
                output_type=output_type,
                )
        output_quantity_formatted += ' %s' % curr_symbol
    return output_quantity_formatted
Start a Compute Engine instance.
dataset/ETHPy150Open blockcypher/blockcypher-python/blockcypher/utils.py/format_crypto_units--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/Solutions-Using-ETL-tool-on-Google-Compute-Engine/etl_demo.py/ComputeManager.StartInstance