def remove_padding(data: bytes, block_n_bytes: int) -> bytes:
    """Removes 0x80... padding according to NIST 800-38A"""
    if len(data) % block_n_bytes != 0:
        raise ValueError("Invalid data")

    for i in range(len(data) - 1, -1, -1):
        if data[i] == 0x80:
            return data[:i]
        elif data[i] != 0x00:
            raise ValueError("Invalid padding")
    raise ValueError("Invalid padding")