def scale(quantity):
    """Primitive unit handling. Should probably use Piquant, quantities, or similar."""
    factors = {'ms': 1, 'mV': 1, 's': 1000, 'V': 1000, 'Hz': 1, 'nF': 1,
        'nA': 1, 'Mohm': 1, 'unknown': 1, 'unitless': 1}
    if quantity.units:
        return quantity.value * factors[quantity.units.name]
    else:
        return quantity.value
