def ListResources(self, credentials, options):
        '''Return an RSpec of resources managed at this AM. 
        If a geni_slice_urn
        is given in the options, then only return resources assigned 
        to that slice. If geni_available is specified in the options,
        then only report available resources. And if geni_compressed
        option is specified, then compress the result.'''
        self.logger.info('ListResources(%r)' % (options))
        # Note this list of privileges is really the name of an operation
        # from the privilege_table in sfa/trust/rights.py
        # Credentials will specify a list of privileges, each of which
        # confers the right to perform a list of operations.
        # EG the 'info' privilege in a credential allows the operations
        # listslices, listnodes, policy

        # could require list or listnodes?
        privileges = ()
        # Note that verify throws an exception on failure.
        # Use the client PEM format cert as retrieved
        # from the https connection by the SecureXMLRPCServer
        # to identify the caller.
        self._cred_verifier.verify_from_strings(self._server.pem_cert,
                                                credentials,
                                                None,
                                                privileges)
        # If we get here, the credentials give the caller
        # all needed privileges to act on the given target.

        if not options:
            options = dict()

        # Look to see what RSpec version the client requested
        if 'rspec_version' in options:
            # we only have one, so nothing to do here
            # But an AM with multiple formats supported
            # would use this to decide how to format the return.

            # Can also error-check that the input value is supported.
            rspec_type = options['rspec_version']['type']
            rspec_version = options['rspec_version']['version']
            if rspec_type is not 'GCF':
                self.logger.warn("Returning GCF rspec even though request said %s", rspec_type)
            self.logger.info("ListResources requested rspec %s (%d)", rspec_type, rspec_version)

        if 'geni_slice_urn' in options:
            slice_urn = options['geni_slice_urn']
            if self._slivers in slice_urn:
                sliver = self._slivers[slice_urn]
                result = ('<rspec type="GCF">'
                          + ''.join([x.toxml() for x in sliver.resources])
                          + '</rspec>')
            else:
                # return an empty rspec
                result = '<rspec type="GCF"/>'
        elif 'geni_available' in options and options['geni_available']:
            result = ('<rspec type="GCF">' + ''.join([x.toxml() for x in self._resources])
                      + '</rspec>')
            # To make this AM return a fixed RSpec do:
            # rspecfile = open('/tmp/sample-of-ad-rspec.xml')
            # result = ''
            # for line in rspecfile:
            #     result += line
            # rspecfile.close()
        else:
            all_resources = list()
            all_resources.extend(self._resources)
            for sliver in self._slivers:
                all_resources.extend(self._slivers[sliver].resources)
            result = ('<rspec type="GCF">' + ''.join([x.toxml() for x in all_resources])
                      + '</rspec>')

#        self.logger.debug('Returning resource list %s', result)
            # To make this AM return a fixed RSpec do:
            # rspecfile = open('/tmp/sample-of-ad-rspec.xml')
            # result = ''
            # for line in rspecfile:
            #     result += line
            # rspecfile.close()

        # Optionally compress the result
        if 'geni_compressed' in options and options['geni_compressed']:
            try:
                result = base64.b64encode(zlib.compress(result))
            except Exception, exc:
                import traceback
                self.logger.error("Error compressing and encoding resource list: %s", traceback.format_exc())
                raise Exception("Server error compressing resource list", exc)

        return result

    # The list of credentials are options - some single cred
    # must give the caller required permissions.
    # The semantics of the API are unclear on this point, so 
    # this is just the current implementation
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/ext/geni/am.py/ReferenceAggregateManager.ListResources/swapped operands of `in`