Given a character to Morse code mapping, convert the input string to Morse code form.
Asked in the phone interview stage. The mapping is a dictionary, and every character in the input appears as a key. Return Morse codes separated by single spaces, preserving character order.
Implement encode_to_morse(mapping, text). mapping is a dictionary from one-character strings to Morse strings. text is a string. Return one string containing the encoded Morse tokens.
def encode_to_morse(mapping, text):