<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copyto_file_path(self, query, path, append=False):
 """ Gets data from a table into a writable file :type query: str :param path: A path to a writable file :type path: str :param append: Whether to append or not if the file already exists Default value is False :type append: bool :raise CartoException: """

        file_mode = 'wb' if not append else 'ab'
        with open(path, file_mode) as f:
            self.copyto_file_object(query, f)