def mymap(val, in_min, in_max, out_min, out_max):
    """
    Returns the value which was mapped between in_min and in_max,
    but now mapped between out_min and out_max.
    If value is outside of bounds, it will still be outside afterwards.
    """

    return int((val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min)