parameters: (new_dir)
docstring: Temporarily change current directory
docstring_summary: Temporarily change current directory
docstring_tokens: Temporarily change current directory
function: def cd(new_dir):
      """ Temporarily change current directory """
      if new_dir:
          old_dir = os.getcwd()
          os.chdir(new_dir)
      yield
      if new_dir:
          os.chdir(old_dir)
function_tokens: def cd ( new_dir ) : if new_dir : old_dir = os . getcwd ( ) os . chdir ( new_dir ) yield if new_dir : os . chdir ( old_dir )