<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(self, input_str):
 """ Adds content to the Dockerfile. :param input_str: Content. :type input_str: unicode | str """

        self.check_not_finalized()
        if isinstance(input_str, six.binary_type):
            self.fileobj.write(input_str)
        else:
            self.fileobj.write(input_str.encode('utf-8'))