def _strip_placeholder_braces(p_matchobj):
    """
    Returns string with conditional braces around placeholder stripped and
    percent sign glued into placeholder character.

    Returned string is composed from 'start', 'before', 'placeholder', 'after',
    'whitespace', and 'end' match-groups of p_matchobj. Conditional braces are
    stripped from 'before' and 'after' groups. 'whitespace', 'start', and 'end'
    groups are preserved without any change.

    Using this function as an 'repl' argument in re.sub it is possible to turn:
        %{(}B{)}
    into:
        (%B)
    """
    before = p_matchobj.group('before') or ''
    placeholder = p_matchobj.group('placeholder')
    after = p_matchobj.group('after') or ''
    whitespace = p_matchobj.group('whitespace') or ''

    return before + '%' + placeholder + after + whitespace
Returns string with conditional braces around placeholder stripped and
    percent sign glued into placeholder character.

    Returned string is composed from 'start', 'before', 'placeholder', 'after',
    'whitespace', and 'end' match-groups of p_matchobj. Conditional braces are
    stripped from 'before' and 'after' groups. 'whitespace', 'start', and 'end'
    groups are preserved without any change.

    Using this function as an 'repl' argument in re.sub it is possible to turn:
        %{(}B{)}
    into:
        (%B)