parameters: (exportpath, dirname)
return_statement: return dirpath
docstring: Given a basename, create a directory in exportpath
  
  	If the directory already exists, remove all png's contained therein.
  	If it	exists but is not a directory, rename the file to something
  	similar but unused. If no exception is raised, then a directory by
  	the specified name will have been created and its absolute path will
  	have been returned as a string.
docstring_summary: Given a basename, create a directory in exportpath
docstring_tokens: Given a basename create a directory in exportpath
function: def makedir(exportpath, dirname):
  	""" Given a basename, create a directory in exportpath
  
  	If the directory already exists, remove all png's contained therein.
  	If it	exists but is not a directory, rename the file to something
  	similar but unused. If no exception is raised, then a directory by
  	the specified name will have been created and its absolute path will
  	have been returned as a string.
  
  	"""
  
  	dirpath = os.path.join(exportpath, dirname)
  	if os.path.exists(dirpath):
  		if os.path.isdir(dirpath):
  			print dirname, "already exists: removing contained png files"
  			for fn in os.listdir(dirpath):
  				if fn.lower().endswith('.png'): os.remove(os.path.join(dirpath, fn))
  			return dirpath
  		else:
  			count = 0
  			while os.path.exists("%s.%i" % (dirpath, count)):
  				count += 1
  			new_path = "%s.%i" % (dirpath, count)
  			shutil.move(dirpath, new_path)
  			print "error:", dirname, "is not a directory. moving file to", new_path
  	print "creating directory:", dirname
  	os.mkdir(dirpath)
  	return dirpath
function_tokens: def makedir ( exportpath , dirname ) : dirpath = os . path . join ( exportpath , dirname ) if os . path . exists ( dirpath ) : if os . path . isdir ( dirpath ) : print dirname , "already exists: removing contained png files" for fn in os . listdir ( dirpath ) : if fn . lower ( ) . endswith ( '.png' ) : os . remove ( os . path . join ( dirpath , fn ) ) return dirpath else : count = 0 while os . path . exists ( "%s.%i" % ( dirpath , count ) ) : count += 1 new_path = "%s.%i" % ( dirpath , count ) shutil . move ( dirpath , new_path ) print "error:" , dirname , "is not a directory. moving file to" , new_path print "creating directory:" , dirname os . mkdir ( dirpath ) return dirpath