def METHOD_NAME(self, origin: Optional[str] = None) -> bool:
    """Check Origin == Host or Access-Control-Allow-Origin.
    Tornado >= 4 calls this method automatically, raising 403 if it returns False.
    """
    if self.allow_origin == "*" or (
        hasattr(self, "skip_check_origin") and self.skip_check_origin()
    ):
        return True
    host = self.request.headers.get("Host")
    if origin is None:
        origin = self.get_origin()
    # If no origin or host header is provided, assume from script
    if origin is None or host is None:
        return True
    origin = origin.lower()
    origin_host = urlparse(origin).netloc
    # OK if origin matches host
    if origin_host == host:
        return True
    # Check CORS headers
    if self.allow_origin:
        allow = self.allow_origin == origin
    elif self.allow_origin_pat:
        allow = bool(re.match(self.allow_origin_pat, origin))
    else:
        # No CORS headers deny the request
        allow = False
    if not allow:
        self.log.warning(
            "Blocking Cross Origin WebSocket Attempt.  Origin: %s, Host: %s",
            origin,
            host,
        )
    return allow