<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def is_authorized(job=None):
    '''Returns true if the request is authorized for the job
    if provided. If no job is provided, the user has to be admin
    to be authorized.
    '''
    if flogin.current_user.is_authenticated:
        return True
    if job:
        job_key = flask.request.headers.get('Authorization')
        if job_key == app.config.get('SECRET_KEY'):
            return True
        return job['job_key'] == job_key
    return False