parameters: (dir, ext='.bak')
return_statement: return dir + extension
docstring: Figure out the name of a directory to back up the given dir to
  
      (adding .bak, .bak2, etc)
docstring_summary: Figure out the name of a directory to back up the given dir to
docstring_tokens: Figure out the name of a directory to back up the given dir to
function: def backup_dir(dir, ext='.bak'):
  
      # type: (str, str) -> str
  
      """Figure out the name of a directory to back up the given dir to
  
      (adding .bak, .bak2, etc)"""
  
      n = 1
  
      extension = ext
  
      while os.path.exists(dir + extension):
  
          n += 1
  
          extension = ext + str(n)
  
      return dir + extension
function_tokens: def backup_dir ( dir , ext = '.bak' ) : # type: (str, str) -> str n = 1 extension = ext while os . path . exists ( dir + extension ) : n += 1 extension = ext + str ( n ) return dir + extension