def is_safe_path(path):
contains_windows_var = lambda val: re.match(r'<STR_LIT>', val)<EOL>contains_posix_var = lambda val: re.match(r'<STR_LIT>', val)<EOL>unsafeness_conditions = [<EOL>os.path.isabs(path),<EOL>('<STR_LIT>' % os.path.sep) in path,<EOL>path.startswith('<STR_LIT>'),<EOL>os.path.expandvars(path) != path,<EOL>contains_windows_var(path),<EOL>contains_posix_var(path),<EOL>]<EOL>return not any(unsafeness_conditions)<EOL>
Check if path is safe and allowed.