def contained_in(filename, directory):
filename = os.path.normcase(os.path.abspath(filename))<EOL>directory = os.path.normcase(os.path.abspath(directory))<EOL>return os.path.commonprefix([filename, directory]) == directory<EOL>
Test if a file is located within the given directory.