locale_dirs is a list of elements from the list of path names that maths the basedir path with '/*' wild card characters for which call to the os.path.isdir returned true, assign it to locale_dirs.
locale_dirs = filter ( os . path . isdir , glob . glob ( '%s/*' % basedir ) )