def sexp_to_bytearray(sexp):
    """
    Utility that converts an sexp that represents a byte array (as found in ion_hash_test.ion)
    to an actual bytearray.
    """
    ba = bytearray()
    for b in sexp:
        ba.append(b)
    return ba