def parseFloat(s, ret=0.0):
    """Parses a value as float."""
    if not isinstance(s, str):
        return float(s)
    elif s:
        if s[0] in "+-":
            ts = s[1:]
        else:
            ts = s

        if ts and ts.count(".") <= 1 and all([_ in ".0123456789" for _ in ts]):
            return float(s)

    return ret