def get_options(self,
                    table,
                    fields=None,
                    show_uids=False,
                    hierarchy=False):
        """
            Get options of option fields in a table as <select>s

            @param prefix: the application prefix
            @param name: the resource name (without prefix)
            @param fields: optional list of fieldnames
            @param show_uids: include UIDs in foreign key options
            @param hierarchy: include parent IDs in foreign key options (if
                              the lookup table is hierarchical)
        """

        if fields:
            if not isinstance(fields, (list, tuple, set)):
                fields = [fields]
            if len(fields) == 1:
                # Single field: omit the outer <options> element
                return self.get_field_options(table,
                                              fields[0],
                                              show_uids=show_uids,
                                              hierarchy=hierarchy,
                                              )

        options = etree.Element(self.TAG.options)

        if table:
            options.set(self.ATTRIBUTE.resource, table._tablename)
            get_field_options = self.get_field_options
            for f in table.fields:
                if not fields or f in fields:
                    get_field_options(table, f,
                                      parent=options,
                                      show_uids=show_uids,
                                      hierarchy=hierarchy,
                                      )
        return options

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/s3xml.py/S3XML.get_options/original