r"""Replaces double square brackets with variable length completion.

    Completion cannot be mixed with regexp matching or '\' characters
    i.e. '[[(\n)]] would become (\(n)?)?.'

    Args:
      match: A regex Match() object.

    Returns:
      String of the format '(a(b(c(d)?)?)?)?'.

def _Completion(self, match):
    # pylint: disable=C6114
    r"""Replaces double square brackets with variable length completion.

    Completion cannot be mixed with regexp matching or '\' characters
    i.e. '[[(\n)]] would become (\(n)?)?.'

    Args:
      match: A regex Match() object.

    Returns:
      String of the format '(a(b(c(d)?)?)?)?'.
    """
    # Strip the outer '[[' & ']]' and replace with ()? regexp pattern.
    word = str(match.group())[2:-2]
    return '(' + ('(').join(word) + ')?' * len(word)