def METHOD_NAME(x, offset, size):
    if isinstance(x, BitVec) and isinstance(offset, BitVec):
        return BitVecExtract(operand=x >> offset, offset=0, size=size)
    elif isinstance(x, BitVec):
        if offset == 0 and size == x.size:
            return x
        return BitVecExtract(operand=x, offset=offset, size=size)
    else:
        return (x >> offset) & ((1 << size) - 1)