def _btc_witness_serialize_unit(unit):
    """
    Encode one item of a BTC witness script
    Return the encoded item (as a string)

    Returns a byte string with the encoded unit

    Based on code from pybitcointools (https://github.com/vbuterin/pybitcointools)
    by Vitalik Buterin
    """
    
    if isinstance(unit, int):
        # pass literal
        return encoding.from_int_to_byte(unit)

    elif unit is None:
        # None means OP_0
        return b'\x00'

    else:
        # return as a varint-prefixed string
        return make_var_string(unit)
def _btc_witness_serialize_unit ( unit ) : if isinstance ( unit , int ) : return encoding . from_int_to_byte ( unit ) elif unit is None : return b'\x00' else : return make_var_string ( unit )
Encode one item of a BTC witness script
    Return the encoded item (as a string)

    Returns a byte string with the encoded unit

    Based on code from pybitcointools (https://github.com/vbuterin/pybitcointools)
    by Vitalik Buterin