def _protect_identifiers(self, item, prefix_single=False, protect_identifiers=None, field_exists=True):
        """

        @param item:
        @param prefix_single:
        @param protect_identifiers:
        @param field_exists:
        """
        if not isinstance(protect_identifiers, bool):
            protect_identifiers = self._protect_identifiers_

        if isinstance(item, dict):
            escaped_dict = dict()
            for k, v in item.iteritems():
                escaped_dict[self._protect_identifiers(k)] = self._protect_identifiers(v)
            return escaped_dict

        # Convert tabs or multiple spaces into single spaces
        item = re.sub(r'[\t ]+', ' ', item)

        if item.find(' ') != -1:
            alias = item[item.find(' '):]
            item = item[0:item.find(' ')]
        else:
            alias = ''

        if item.find('(') != -1:
            return item+alias

        if item.find('.') != -1:
            parts = item.split('.')
            if parts[0] in self.ar_aliased_tables:
                if protect_identifiers is True:
                    for key, val in enumerate(parts):
                        if val not in self._reserved_identifiers:
                            parts[key] = self._escape_identifiers(val)
                    item = '.'.join(parts)
                return item+alias
            if protect_identifiers is True:
                item = self._escape_identifiers(item)
            return item+alias
        if protect_identifiers is True and item not in self._reserved_identifiers:
            item = self._escape_identifiers(item)
        return item+alias
def _protect_identifiers ( self , item , prefix_single = False , protect_identifiers = None , field_exists = True ) : if not isinstance ( protect_identifiers , bool ) : protect_identifiers = self . _protect_identifiers_ if isinstance ( item , dict ) : escaped_dict = dict ( ) for k , v in item . iteritems ( ) : escaped_dict [ self . _protect_identifiers ( k ) ] = self . _protect_identifiers ( v ) return escaped_dict item = re . sub ( r'[\t ]+' , ' ' , item ) if item . find ( ' ' ) != - 1 : alias = item [ item . find ( ' ' ) : ] item = item [ 0 : item . find ( ' ' ) ] else : alias = '' if item . find ( '(' ) != - 1 : return item + alias if item . find ( '.' ) != - 1 : parts = item . split ( '.' ) if parts [ 0 ] in self . ar_aliased_tables : if protect_identifiers is True : for key , val in enumerate ( parts ) : if val not in self . _reserved_identifiers : parts [ key ] = self . _escape_identifiers ( val ) item = '.' . join ( parts ) return item + alias if protect_identifiers is True : item = self . _escape_identifiers ( item ) return item + alias if protect_identifiers is True and item not in self . _reserved_identifiers : item = self . _escape_identifiers ( item ) return item + alias
@param item:
        @param prefix_single:
        @param protect_identifiers:
        @param field_exists: