<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def msguniq(self, locale_file):
 """ run msgunique on the locale_file """


        # group related language strings together.
        # except if no real entries where written or the header will be removed.
        p = subprocess.Popen('msguniq --to-code=utf-8 %s' % (locale_file,),
            shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
        (msg, err) = p.communicate()

        if err:
            # raise exception, none of the stuff in stderr are just warmings
            logging.error(err)
            try:
                err = unicodedata.normalize('NFKD', err.decode('utf-8')).encode('ascii','ignore')
            except UnicodeError:
                err = "can not decode error message"
            raise CommandError(
                u"error happened while running msguniq on: %s %s" % \
                    (locale_file, err)
            )

        return msg