def METHOD_NAME(self):
    if self.get("vsize"):
        return self["vsize"]
    tx = self.tx
    txsize = len(tx.serialize())
    # tx size - flag - marker - witness
    non_witness_size = (
        txsize
        - 2
        - sum([len(inp.witness.serialize()) for inp in tx.vin])
        - sum([len(out.witness.serialize()) for out in tx.vout])
    )
    witness_size = txsize - non_witness_size
    weight = non_witness_size * 4 + witness_size
    METHOD_NAME = math.ceil(weight / 4)
    return METHOD_NAME