human
Complete the below
def cors_enabled(origin, methods=['GET']):

    ''''A simple decorator to enable CORS.'
    '''

=====
Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    def decorator(f):
        @wraps(f)
        def decorated_func(request, *args, **kwargs):
            if (request.method == 'OPTIONS'):
                if (('HTTP_ACCESS_CONTROL_REQUEST_METHOD' in request.META) and ('HTTP_ACCESS_CONTROL_REQUEST_HEADERS' in request.META)):
                    response = http.HttpResponse()
                    response['Access-Control-Allow-Methods'] = ',    '.join(methods)
                    response['Access-Control-Allow-Headers'] = request.META['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
                else:
                    return http.HttpResponseBadRequest()
            elif (request.method in methods):
                response = f(request, *args, **kwargs)
            else:
                return http.HttpResponseBadRequest()
            response['Access-Control-Allow-Origin'] = origin
            return response
        return decorated_func
    return decorator