def filter_fields(self, fields=[], exclude=[], include_all_if_empty=True):
        """
        filter fields

        fields:
        exclude:
        include_all_if_empty: if fields is empty return all fields

        return: fileds
        """
        if not include_all_if_empty and not fields:
            return []
        ret = []
        for f in self.visible_fields():
            if fields and f.name not in fields:
                continue
            if exclude and f.name in exclude:
                continue
            ret.append(f)
        return ret
filter fields

        fields:
        exclude:
        include_all_if_empty: if fields is empty return all fields

        return: fileds