<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_input(self, output_dir=".", make_dir_if_not_present=True):
 """ Write VASP input to a directory. Args: output_dir (str):
 Directory to write to. Defaults to current directory ("."). make_dir_if_not_present (bool):
 Create the directory if not present. Defaults to True. """

        if make_dir_if_not_present and not os.path.exists(output_dir):
            os.makedirs(output_dir)
        for k, v in self.items():
            with zopen(os.path.join(output_dir, k), "wt") as f:
                f.write(v.__str__())