<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_to_sha(msg):
 """coerce numeric list inst sha-looking bytearray"""

    if isinstance(msg, str):
        msg = msg.encode('utf-8')
    return (codecs.encode(msg, "hex_codec") + (b'00' * 32))[:64]