'Parse a CSV list of strings/regexp of hostnames that should be allowed
to use CORS and will be sent the Access-Control-Allow-Origin header.'

def _parse_allowed_origin_hostnames(self, kwargs):

    allowed_origin_hostnames = listify(kwargs.get('allowed_origin_hostnames', None))
    if (not allowed_origin_hostnames):
        return None
    def parse(string):
        if ((string[0] == '/') and (string[(-1)] == '/')):
            string = string[1:(-1)]
            return re.compile(string, flags=(re.UNICODE | re.LOCALE))
        return string
    return [parse(v) for v in allowed_origin_hostnames if v]
