def remove(self, elem):
        """Remove a requirement.

        :param elem: a string or :class:`Requirement` instance.
        """
        if isinstance(elem, text_type):
            for requirement in self:
                if requirement.package == elem:
                    return super(Requirements, self).remove(requirement)
        return super(Requirements, self).remove(elem)
def _stats_to_str(self, stats: Dict[str, str]) -> str:
        stage = f"{self._stage.upper()} " if self._stage is not None else ""
        output = [stage + "Profiler Report"]
        for action, value in stats.items():
            header = f"Profile stats for: {action}"
            if self._local_rank is not None:
                header += f" rank: {self._local_rank}"
            output.append(header)
            output.append(value)
        return os.linesep.join(output)