code: def chdir(self, directory_path, make=False):
          
          if os.sep in directory_path:
              for directory in directory_path.split(os.sep):
                  if make and not self.directory_exists(directory):
                      try:
                          self.session.mkd(directory)
                      except ftplib.error_perm:
                          # Directory already exists
                          pass
                  self.session.cwd(directory)
          else:
              self.session.cwd(directory_path)
docs: Change directories and optionally make the directory if it doesn't exist.