Human: Give me a Python code to sort by a token in string. Assistant: 
Here is a Python code to sort by a token in string

import string

def sort_by_token(string, token):
    """Sort a string by a token.

    Args:
        string (str): String to be sorted.
        token (str): Token to be used for sorting.

    Returns:
        Sorted string.
    """
    return sorted(string, key=lambda x: x.find(token))

# Enter the string
string ="blue bicycle"

# Calling the function
sorted_string = sort_by_token(string, 'a')

# Printing the result

#Remember to inspect code for bugs.