Serves a cross-domain policy which can allow other policies
    to exist on the same domain.

    Note that this view, if used, must be the master policy for the
    domain, and so must be served from the URL ``/crossdomain.xml`` on
    the domain: setting metapolicy information in other policy files
    is forbidden by the cross-domain policy specification.

    **Required arguments:**

    ``permitted``
        A string indicating the extent to which other policies are
        permitted. A set of constants is available in
        ``flashpolicies.policies``, defining acceptable values for
        this argument.

    **Optional arguments:**

    ``domains``
        A list of domains from which to allow access. Each value may
        be either a domain name (e.g., ``example.com``) or a wildcard
        (e.g., ``*.example.com``). Due to serious potential security
        issues, it is strongly recommended that you not use wildcard
        domain values.

def metapolicy(request, permitted, domains=None):
    """
    Serves a cross-domain policy which can allow other policies
    to exist on the same domain.

    Note that this view, if used, must be the master policy for the
    domain, and so must be served from the URL ``/crossdomain.xml`` on
    the domain: setting metapolicy information in other policy files
    is forbidden by the cross-domain policy specification.

    **Required arguments:**

    ``permitted``
        A string indicating the extent to which other policies are
        permitted. A set of constants is available in
        ``flashpolicies.policies``, defining acceptable values for
        this argument.

    **Optional arguments:**

    ``domains``
        A list of domains from which to allow access. Each value may
        be either a domain name (e.g., ``example.com``) or a wildcard
        (e.g., ``*.example.com``). Due to serious potential security
        issues, it is strongly recommended that you not use wildcard
        domain values.

    """
    if domains is None:
        domains = []
    policy = policies.Policy(*domains)
    policy.metapolicy(permitted)
    return serve(request, policy)