<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_range(element, ranges, dimension):
 """ Computes the data, soft- and hard-range along a dimension given an element and a dictionary of ranges. """

    if dimension and dimension != 'categorical':
        if ranges and dimension.name in ranges:
            drange = ranges[dimension.name]['data']
            srange = ranges[dimension.name]['soft']
            hrange = ranges[dimension.name]['hard']
        else:
            drange = element.range(dimension, dimension_range=False)
            srange = dimension.soft_range
            hrange = dimension.range
    else:
        drange = srange = hrange = (np.NaN, np.NaN)
    return drange, srange, hrange