Return the appropriate text for a group of return elements.

def parse_return_elements(return_vals_group, return_element_name,
                              return_element_type, placeholder):
        """Return the appropriate text for a group of return elements."""
        all_eq = (return_vals_group.count(return_vals_group[0])
                  == len(return_vals_group))
        if all([{'[list]', '(tuple)', '{dict}', '{set}'}.issuperset(
                return_vals_group)]) and all_eq:
            return return_element_type.format(
                return_type=return_vals_group[0][1:-1])
        # Output placeholder if special Python chars present in name
        py_chars = {' ', '+', '-', '*', '/', '%', '@', '<', '>', '&', '|', '^',
                    '~', '=', ',', ':', ';', '#', '(', '[', '{', '}', ']',
                    ')', }
        if any([any([py_char in return_val for py_char in py_chars])
                for return_val in return_vals_group]):
            return placeholder
        # Output str type and no name if only string literals
        if all(['"' in return_val or '\'' in return_val
                for return_val in return_vals_group]):
            return return_element_type.format(return_type='str')
        # Output bool type and no name if only bool literals
        if {'True', 'False'}.issuperset(return_vals_group):
            return return_element_type.format(return_type='bool')
        # Output numeric types and no name if only numeric literals
        try:
            [float(return_val) for return_val in return_vals_group]
            num_not_int = 0
            for return_val in return_vals_group:
                try:
                    int(return_val)
                except ValueError:  # If not an integer (EAFP)
                    num_not_int = num_not_int + 1
            if num_not_int == 0:
                return return_element_type.format(return_type='int')
            elif num_not_int == len(return_vals_group):
                return return_element_type.format(return_type='float')
            else:
                return return_element_type.format(return_type='numeric')
        except ValueError:  # Not a numeric if float conversion didn't work
            pass
        # If names are not equal, don't contain "." or are a builtin
        if ({'self', 'cls', 'None'}.isdisjoint(return_vals_group) and all_eq
                and all(['.' not in return_val
                         for return_val in return_vals_group])):
            return return_element_name.format(return_name=return_vals_group[0])
        return placeholder