def is_excluded(root, excludes):
sep = os.path.sep<EOL>if not root.endswith(sep):<EOL><INDENT>root += sep<EOL><DEDENT>for exclude in excludes:<EOL><INDENT>if root.startswith(exclude):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
Check if the directory is in the exclude list.

Note: by having trailing slashes, we avoid common prefix issues, like
      e.g. an exlude "foo" also accidentally excluding "foobar".