request an access ticket

        This method requests an access ticket for an access realm. The
        server responds by granting the access ticket.  If the client
        does not have access rights to the requested realm this causes
        a connection exception.  Access tickets are a per-channel
        resource.

        RULE:

            The realm name MUST start with either "/data" (for
            application resources) or "/admin" (for server
            administration resources). If the realm starts with any
            other path, the server MUST raise a connection exception
            with reply code 403 (access refused).

        RULE:

            The server MUST implement the /data realm and MAY
            implement the /admin realm.  The mapping of resources to
            realms is not defined in the protocol - this is a server-
            side configuration issue.

        PARAMETERS:
            realm: shortstr

                name of requested realm

                RULE:

                    If the specified realm is not known to the server,
                    the server must raise a channel exception with
                    reply code 402 (invalid path).

            exclusive: boolean

                request exclusive access

                Request exclusive access to the realm. If the server
                cannot grant this - because there are other active
                tickets for the realm - it raises a channel exception.

            passive: boolean

                request passive access

                Request message passive access to the specified access
                realm. Passive access lets a client get information
                about resources in the realm but not to make any
                changes to them.

            active: boolean

                request active access

                Request message active access to the specified access
                realm. Acvtive access lets a client get create and
                delete resources in the realm.

            write: boolean

                request write access

                Request write access to the specified access realm.
                Write access lets a client publish messages to all
                exchanges in the realm.

            read: boolean

                request read access

                Request read access to the specified access realm.
                Read access lets a client consume messages from queues
                in the realm.

        The most recently requested ticket is used as the channel's
        default ticket for any method that requires a ticket.

def access_request(self, realm, exclusive=False,
        passive=False, active=False, write=False, read=False):
        """
        request an access ticket

        This method requests an access ticket for an access realm. The
        server responds by granting the access ticket.  If the client
        does not have access rights to the requested realm this causes
        a connection exception.  Access tickets are a per-channel
        resource.

        RULE:

            The realm name MUST start with either "/data" (for
            application resources) or "/admin" (for server
            administration resources). If the realm starts with any
            other path, the server MUST raise a connection exception
            with reply code 403 (access refused).

        RULE:

            The server MUST implement the /data realm and MAY
            implement the /admin realm.  The mapping of resources to
            realms is not defined in the protocol - this is a server-
            side configuration issue.

        PARAMETERS:
            realm: shortstr

                name of requested realm

                RULE:

                    If the specified realm is not known to the server,
                    the server must raise a channel exception with
                    reply code 402 (invalid path).

            exclusive: boolean

                request exclusive access

                Request exclusive access to the realm. If the server
                cannot grant this - because there are other active
                tickets for the realm - it raises a channel exception.

            passive: boolean

                request passive access

                Request message passive access to the specified access
                realm. Passive access lets a client get information
                about resources in the realm but not to make any
                changes to them.

            active: boolean

                request active access

                Request message active access to the specified access
                realm. Acvtive access lets a client get create and
                delete resources in the realm.

            write: boolean

                request write access

                Request write access to the specified access realm.
                Write access lets a client publish messages to all
                exchanges in the realm.

            read: boolean

                request read access

                Request read access to the specified access realm.
                Read access lets a client consume messages from queues
                in the realm.

        The most recently requested ticket is used as the channel's
        default ticket for any method that requires a ticket.

        """
        args = AMQPWriter()
        args.write_shortstr(realm)
        args.write_bit(exclusive)
        args.write_bit(passive)
        args.write_bit(active)
        args.write_bit(write)
        args.write_bit(read)
        self._send_method((30, 10), args)
        return self.wait(allowed_methods=[
                          (30, 11),    # Channel.access_request_ok
                        ])