<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dim_range_key(eldim):
 """ Returns the key to look up a dimension range. """

    if isinstance(eldim, dim):
        dim_name = repr(eldim)
        if dim_name.startswith("'") and dim_name.endswith("'"):
            dim_name = dim_name[1:-1]
    else:
        dim_name = eldim.name
    return dim_name