def astuple(v):
    """
    Cast to tuple but handle the case where 'v' could be a
    str of values '(a,b,c,...)' and then parse the values
    as floats.
    """
    if isinstance(v, str):
        return tuple([float(x) for x in v[1:-1].split(",")])
    else:
        return tuple(v)