def METHOD_NAME():
    ctx = bpy.context.copy()
    for area in bpy.context.window.screen.areas:
        if area.type != 'GRAPH_EDITOR':
            continue
        ctx['area'] = area
        ctx['space'] = area.spaces.active
        break
    return ctx