def initializeMaildir(dir):
 if (not os.path.isdir(dir)):
  os.mkdir(dir, 448)
  for subdir in ['new', 'cur', 'tmp', '.Trash']:
   os.mkdir(os.path.join(dir, subdir), 448)
  for subdir in ['new', 'cur', 'tmp']:
   os.mkdir(os.path.join(dir, '.Trash', subdir), 448)
  open(os.path.join(dir, '.Trash', 'maildirfolder'), 'w').close()

def initializeMaildir ( dir ) : if ( not os . path . isdir ( dir ) ) : os . mkdir ( dir , 448 ) for subdir in [ 'new' , 'cur' , 'tmp' , '.Trash' ] : os . mkdir ( os . path . join ( dir , subdir ) , 448 ) for subdir in [ 'new' , 'cur' , 'tmp' ] : os . mkdir ( os . path . join ( dir , '.Trash' , subdir ) , 448 ) open ( os . path . join ( dir , '.Trash' , 'maildirfolder' ) , 'w' ) . close ( )
create a maildir user directory if it doesnt already exist .