def scale(x, space):
    """
    Scale some input to be between the range [-1;1] from the range
    of the space it belongs to
    """
    return 2.0 * (x - space.low) / (space.high - space.low) - 1.0