<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_origin(self, origin):
 """ If cors is enabled, check that the origin is allowed """


        mod_opts = self.application.mod_opts

        if mod_opts.get('cors_origin'):
            return bool(_check_cors_origin(origin, mod_opts['cors_origin']))
        else:
            return super(AllEventsHandler, self).check_origin(origin)