def bytes_find_single(x: bytes, sub: int, start: int, end: int) -> int:
    """Where is the first location of a specified byte within a given slice of a bytes object?

    Compiling bytes.find compiles this function, when sub is an integer 0 to 255.
    This function is only intended to be executed in this compiled form.

    Args:
        x: The bytes object in which to search.
        sub: The subsequence to look for, as a single byte specified as an integer 0 to 255.
        start: Beginning of slice of x.  Interpreted as slice notation.
        end: End of slice of x.  Interpreted as slice notation.

    Returns:
        Lowest index of match within slice of x, or -1 if not found.

    Raises:
        ValueError: The sub argument is out of valid range.
    """
    if sub < 0 or sub > 255:
        raise ValueError("byte must be in range(0, 256)")
    if start < 0:
        start += len(x)
    if start < 0:
        start = 0
    if end < 0:
        end += len(x)
    if end < 0:
        end = 0
    if end > len(x):
        end = len(x)

    index = start
    while index < end:
        if x[index] == sub:
            return index
        index += 1
    return -1