<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def string(self, units: typing.Optional[str] = None) -> str: """Return a string representation of the pressure, using the given units."""

        if not units:
            _units: str = self._units
        else:
            if not units.upper() in CustomPressure.legal_units:
                raise UnitsError("unrecognized pressure unit: '" + units + "'")
            _units = units.upper()
        val = self.value(units)
        if _units == "MB":
            return "%.0f mb" % val
        if _units == "HPA":
            return "%.0f hPa" % val
        if _units == "IN":
            return "%.2f inches" % val
        if _units == "MM":
            return "%.0f mmHg" % val

        raise ValueError(_units)