<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def to_string(direction):
    '''Returns the correct string for a given direction.

    @raises InvalidDirectionError

    '''
    if direction == UP:
        return UP
    elif direction == DOWN:
        return DOWN
    elif direction == LEFT:
        return LEFT
    elif direction == RIGHT:
        return RIGHT
    else:
        raise InvalidDirectionError(type_string)