def fnsplit(fn):
    """/path/fnr.x -> (/path/fnr, x) when possible.  Non-str treated as None."""
    if not (isinstance(fn, str) and fn):
        return (None, None)
    fn = fn.strip()
    if not fn:	
        return (None, None)
    x = fn.rfind('.')
    if x == -1:
        return fn, None
    return (fn[:x], fn[x:])