def metapolicy(self, permitted):
        """
        Sets metapolicy to ``permitted``. (only applicable to master
        policy files). Acceptable values correspond to those listed in
        Section 3(b)(i) of the crossdomain.xml specification, and are
        also available as a set of constants defined in this module.

        By default, Flash assumes a value of ``master-only`` for all
        policies except socket policies, (which assume a default of
        ``all``) so if this is desired (and, for security, it
        typically is), this method does not need to be called.

        Note that a metapolicy of ``none`` forbids **all** access,
        even if one or more domains, headers or identities have
        previously been specified as allowed. As such, setting the
        metapolicy to ``none`` will remove all access previously
        granted by ``allow_domain``, ``allow_headers`` or
        ``allow_identity``. Additionally, attempting to grant access
        via ``allow_domain``, ``allow_headers`` or ``allow_identity``
        will, when the metapolicy is ``none``, raise ``TypeError``.

        """
        if permitted not in VALID_SITE_CONTROL:
            raise TypeError(SITE_CONTROL_ERROR.format(permitted))
        if permitted == SITE_CONTROL_NONE:
            # Metapolicy 'none' means no access is permitted.
            self.domains = {}
            self.header_domains = {}
            self.identities = []
        self.site_control = permitted