def METHOD_NAME(self, x, y):
    """
    Post-compose a ribbon diagram with a cup between wires ``i`` and ``j``
    by introducing braids.
    Parameters:
        i : The wire on the left of the cup.
        j : The wire on the right of the cup.
    """
    if min(x, y) < 0 or max(x, y) >= len(self.cod):
        raise ValueError(f'Indices {x, y} are out of range.')
    x, y = min(x, y), max(x, y)
    for i in range(x, y - 1):
        braid = self.braid_factory(self.cod[i], self.cod[i + 1])
        self = self >> self.cod[:i] @ braid @ self.cod[i + 2:]
    METHOD_NAME = self.cup_factory(self.cod[y - 1], self.cod[y])
    return self >> self.cod[:y - 1] @ METHOD_NAME @ self.cod[y + 1:]