def massString(mass):
    """ HELPER FUNCTION. Turns a float mass into a string with the correct units after
    (between mg and kg)

    Arguments:
        mass: [float] the mass to be converted

    Returns:
        mass_str: [string] the mass as a string with the proper units
    """     

    # make mass into str
    if mass < 1:
        mass *= 1000
        if mass < 1:
            mass *= 1000
            mass_str = str(eval("%.0e" % (mass))) + ' mg'
        else:
            mass_str = str(eval("%.0e" % (mass))) + ' g'
    else:
        mass_str = str(eval("%.0e" % (mass))) + ' kg'

    return mass_str