def replace(self, value, name=None):
        """
        Replace string using replacements.

        :param value: string value to be replaced
        :param name: accepts a name
        """
        # If first run, then process the replacements data.
        if self._replacements is None:
            self._replacements_init()

        if not value or not isinstance(value, str):
            return value

        name_used = name
        if name_used not in self._replacements:
            name_used = None

        for pattern, replacement in self._replacements.get(name_used, []):
            value = re.sub(pattern, replacement, value)

        return value

        Replace string using replacements.

        :param value: string value to be replaced
        :param name: accepts a name
        
py3status/py3.py