code: def in_to_out(self, in_path, out_path=None):
          
          if is_same_file(in_path, out_path):
              logger.debug(
                  "in path and out path are the same file. writing to temp "
                  "file and then replacing in path with the temp file.")
              out_path = None
  
          logger.debug(f"opening source file: {in_path}")
          with open(in_path) as infile:
              obj = self.object_representer.load(infile)
  
          if out_path:
              logger.debug(
                  f"opening destination file for writing: {out_path}")
              ensure_dir(out_path)
              with open(out_path, 'w') as outfile:
                  self.object_representer.dump(outfile, self.formatter(obj))
              return
          else:
              logger.debug("opening temp file for writing...")
              with NamedTemporaryFile(mode='w+t',
                                      dir=os.path.dirname(in_path),
                                      delete=False) as outfile:
                  self.object_representer.dump(outfile, self.formatter(obj))
  
              logger.debug(f"moving temp file to: {in_path}")
  
              move_temp_file(outfile.name, infile.name)
docs: Load file into object, formats, writes object to out.
  
          If in_path and out_path point to the same thing it will in-place edit
          and overwrite the in path. Even easier, if you do want to edit a file
          in place, don't specify out_path, or set it to None.
  
          Args:
              in_path: str or path-like. Must refer to a single existing file.
              out_path: str or path-like. Must refer to a single destination file
                        location. will create directory structure if it doesn't
                        exist.
                        If out_path is not specified or None, will in-place edit
                        and overwrite the in-files.
  
          Returns:
              None.