'Determine if each dict elems can fit on one line.'

def _EachDictEntryFitsOnOneLine(self, opening):

    def PreviousNonCommentToken(tok):
        tok = tok.previous_token
        while tok.is_comment:
            tok = tok.previous_token
        return tok
    def ImplicitStringConcatenation(tok):
        num_strings = 0
        if tok.is_pseudo_paren:
            tok = tok.next_token
        while tok.is_string:
            num_strings += 1
            tok = tok.next_token
        return (num_strings > 1)
    closing = opening.matching_bracket
    entry_start = opening.next_token
    current = opening.next_token.next_token
    while (current and (current != closing)):
        if (format_token.Subtype.DICTIONARY_KEY in current.subtypes):
            prev = PreviousNonCommentToken(current)
            length = (prev.total_length - entry_start.total_length)
            length += len(entry_start.value)
            if ((length + self.stack[(-2)].indent) >= self.column_limit):
                return False
            entry_start = current
        if current.OpensScope():
            if (((current.value == '{') or ((current.is_pseudo_paren and (current.next_token.value == '{')) and (format_token.Subtype.DICTIONARY_VALUE in current.subtypes))) or ImplicitStringConcatenation(current)):
                if current.matching_bracket:
                    current = current.matching_bracket
                while current:
                    if (current == closing):
                        return True
                    if (format_token.Subtype.DICTIONARY_KEY in current.subtypes):
                        entry_start = current
                        break
                    current = current.next_token
            else:
                current = current.matching_bracket
        else:
            current = current.next_token
    current = PreviousNonCommentToken(current)
    length = (current.total_length - entry_start.total_length)
    length += len(entry_start.value)
    return ((length + self.stack[(-2)].indent) <= self.column_limit)
