<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scale_calculator(multiplier, elements, rescale=None):
 """Get a dictionary of scales for each element in elements. Examples: {8: 1, 2: 1, 7: 1} {2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1} {2: 1.0, 3: 0.5, 4: 0.5, 5: 0.75, 6: 0.5, 7: 0.5, 8: 0.5} {2: 1.0, 3: 0.5, 4: 0.5, 5: 0.75, 6: 0.5, 7: 0.5, 8: 0.5} {(2, 2, 2):
 0.5, (3,):
 0.5, (6, 7, 8):
 0.5, (4,):
 0.5, (5,):
 1.0} None Args: mutiplier (int, float):
 Base float to be multiplied elements (list, dict):
 Dictionary which contains object:count or list of objects that may have repeats which will be counted rescale (tuple):
 Min and max values to rescale to Returns: dict: Scaled values of mutiplier for each element in elements """


    # TODO: think about what happens when:
    # TODO: 1. there is only one (or n) of each element, and rescale is set to seomthing. what is the original min/max to scale from?
    # TODO: 2. can we normalize the scale based on other counts? (ie. other gene mutation frequencies)

    if isinstance(elements, list):
        unique_elements = list(set(elements))
        scales = {}
        for x in unique_elements:
            count = elements.count(x)
            scales[x] = multiplier * count
    elif isinstance(elements, dict):
        scales = {}
        for k,count in elements.items():
            scales[k] = multiplier * int(count)
    else:
        raise ValueError('Input list of elements or dictionary of elements & counts')

    if not rescale:
        return scales
    else:
        new_scales = {}
        for k,v in scales.items():
            new_scales[k] = remap(v, min(scales.values()), max(scales.values()), rescale[0], rescale[1])
        return new_scales