def rsrpad(data: bytes, block_size_bytes: int) -> bytes:
    """Return data padded to match the specified block_size_bytes.

    Arguments:
        data {bytes} -- Data string to pad.
        block_size_bytes {int} -- Block size for padding.

    Returns:
        bytes -- Padded data.

    The first byte of the padding is null to match the rocksmith standard,
    the remainder fill with the count of bytes padded (RS appears to use
    random chars).

    """
    padding = (block_size_bytes - len(data)) % block_size_bytes
    if padding > 0:
        null_bytes = 1
        pad_byte = chr(padding).encode()
        padding -= 1
    else:
        null_bytes = 0
        pad_byte = b"\x00"

    return data + b"\x00" * null_bytes + pad_byte * padding