def direction_to_degree(direction):
    """ Translates direction to degree

    :param direction: 'N', 'E', 'S', or 'W'
    :return: 0, 90, 180 or 270
    """
    north, east, south, west = 0, 90, 180, 270

    if direction == 'N':
        return north
    elif direction == 'E':
        return east
    elif direction == 'S':
        return south
    else:
        return west