Generate allow origin header

def allow_origin(self, request):
        # type: (BaseHttpRequest) -> str
        """
        Generate allow origin header
        """
        origins = self.origins
        if origins is AnyOrigin:
            return '*'
        else:
            origin = request.origin
            return origin if origin in origins else ''