<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_writer(self):
 """ Get a writer. This method also makes the output filename be the same as the .track file but with .mpc. (Currently only works on local filesystem) :rtype MPCWriter """

        if self._writer is None:
            suffix = tasks.get_suffix(tasks.TRACK_TASK)
            try:
                base_name = re.search("(?P<base_name>.*?)\.\d*{}".format(suffix), self.filename).group('base_name')
            except:
                base_name = os.path.splitext(self.filename)[0]
            mpc_filename_pattern = self.output_context.get_full_path(
                "{}.?{}".format(base_name, suffix))
            mpc_file_count = len(glob(mpc_filename_pattern))
            mpc_filename = "{}.{}{}".format(base_name, mpc_file_count, suffix)
            self._writer = self._create_writer(mpc_filename)

        return self._writer