Instead of this:
FILE = open(f) do_something(FILE) FILE.close()
it\'s better to use this:
with open(f) as FILE: do_some
something like:
if file: #it checks for None,false values no need of "if file is None" with open(file) as FILE: do_something(FILE) else: FILE=None