def sign_extend(value: int, orig_size: int, dest_size: int) -> int:
    """
    Calculates the sign extension for a provided value and a specified destination size.

    :param value: value to be sign extended
    :param orig_size: byte width of value
    :param dest_size: byte width of value to extend to.
    :return: value, sign extended
    """
    if dest_size < orig_size:
        raise ValueError(f"Destination size must be larger than original size.")
    orig_size *= 8
    dest_size *= 8

    # Calculate the max value for orig and dest
    orig_mask = (1 << orig_size) - 1
    dest_mask = (1 << dest_size) - 1
    # Create the bit mask
    masknumber = value & orig_mask
    msb = masknumber >> (orig_size - 1)
    # Perform the sign extension
    if msb:
        signextended = ((dest_mask << orig_size) | masknumber) & dest_mask
    else:
        signextended = value & dest_mask

    return signextended