def safe_mkdir(directory, clean=False):
  """Safely create a directory.

  Ensures a directory is present.  If it's not there, it is created.  If it
  is, it's a no-op.  no-op.  If clean is True, ensures the directory is
  empty.
  """
  if clean:
    safe_rmtree(directory)
  try:
    os.makedirs(directory)
  except __HOLE__ as e:
    if e.errno != errno.EEXIST:
      raise
dataset/ETHPy150Open pantsbuild/pex/pex/common.py/safe_mkdir