def byte_width(number):
    """Determine the smallest number of bytes that can encode a number.

    Parameters
    ----------
    number: int
        The number to be encoded

    Returns
    -------
    int
        The number of bytes required to encode this value.

    """
    abs_number = abs(number)
    if abs_number <= 127:
        return 1
    elif abs_number <= 32767:
        return 2
    elif abs_number <= 2147483647:
        return 4
    else:
        return 8
