def METHOD_NAME(job_ref):
    job_attributes = {
        "db.name": job_ref.project,
        "job_id": job_ref.job_id,
        "state": job_ref.state,
    }
    job_attributes["hasErrors"] = job_ref.error_result is not None
    if job_ref.created is not None:
        job_attributes["timeCreated"] = job_ref.created.isoformat()
    if job_ref.started is not None:
        job_attributes["timeStarted"] = job_ref.started.isoformat()
    if job_ref.ended is not None:
        job_attributes["timeEnded"] = job_ref.ended.isoformat()
    if job_ref.location is not None:
        job_attributes["location"] = job_ref.location
    if job_ref.parent_job_id is not None:
        job_attributes["parent_job_id"] = job_ref.parent_job_id
    if job_ref.num_child_jobs is not None:
        job_attributes["num_child_jobs"] = job_ref.num_child_jobs
    return job_attributes