def write_to_file_item(self, res):
        """
        Function makes proper string from information got from item xml tags
        and poe.trade information and writes it to a file
        :param res: item_container_html
        :return: returns nothing
        """
        parsed_item_container_dict = self.poe_trade_response_handler.item_container_parser(res)
        if parsed_item_container_dict:
            string_for_file_writing = self.get_string_for_file_writing()
            string_for_file_writing += ">>>> From Poe.trade <<<<\n"
            for item_container_tag in sorted(parsed_item_container_dict):
                value = parsed_item_container_dict[item_container_tag]
                string_for_file_writing += "{item_cont}: {value}\n".format(
                    item_cont=item_container_tag, value=value)

            # Check if file exists
            if os.path.isfile(Settings.items_file_name_if_found()):
                # Check if already exists in file
                already_exists = string_for_file_writing in open(Settings.items_file_name_if_found()).read()
                if not already_exists:
                    self.write_to_file_string(string_for_file_writing)
            # File not exists. Can write
            else:
                self.write_to_file_string(string_for_file_writing)
 def write_to_file_string(self, string_to_write):
     """
     Function writes a string to a file which name is defined in Settings.py
     :param string_to_write: string to write
     :return: returns nothing
     """
     filename = Settings.items_file_name_if_found()
     with threading.Lock():
         file_ = codecs.open("./" + filename, 'a', "utf-8")
         file_.write(str(string_to_write + "\n"))
         file_.close()