<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def restrict_with(self, expr: str, error_tag: str = None, error_message: str = None) -> None: """Combine the receiver with new intervals. Args: expr: "range" or "length" expression. error_tag: error tag of the new expression. error_message: error message for the new expression. Raises: InvalidArgument: If parsing of `expr` fails. """

        def parse(x: str) -> Number:
            res = self.parser(x)
            if res is None:
                raise InvalidArgument(expr)
            return res

        def simpl(rng: List[Number]) -> List[Number]:
            return ([rng[0]] if rng[0] == rng[1] else rng)

        def to_num(xs): return [parse(x) for x in xs]
        lo = self.intervals[0][0]
        hi = self.intervals[-1][-1]
        ran = []
        for p in [p.strip() for p in expr.split("|")]:
            r = [i.strip() for i in p.split("..")]
            if len(r) > 2:
                raise InvalidArgument(expr)
            ran.append(r)
        if ran[0][0] != "min":
            lo = parse(ran[0][0])
        if ran[-1][-1] != "max":
            hi = parse(ran[-1][-1])
        self.intervals = (
            [simpl([lo, hi])] if len(ran) == 1 else (
                [simpl([lo, parse(ran[0][-1])])] +
                [to_num(r) for r in ran[1:-1]] +
                [simpl([parse(ran[-1][0]), hi])]))
        if error_tag:
            self.error_tag = error_tag
        if error_message:
            self.error_message = error_message