def parseFraction(f):
    """Parse a fraction (a string of the form N/D) returning a float.
Returns None if f is not in the form N/D, or if D is 0."""
    p = f.find("/")
    if p < 1:
        return None
    s1 = f[:p]
    s2 = f[p+1:]
    try:
        v1 = int(s1)
        v2 = int(s2)
    except ValueError:
        return None
    if v2:
        return 1.0 * v1 / v2
    else:
        return None