<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _run_task(task, start_message, finished_message):
 """ Tasks a task from tasks.py and runs through the commands on the server """


    # Get the hosts and record the start time
    env.hosts = fabconf['EC2_INSTANCES']
    start = time.time()

    # Check if any hosts exist
    if env.hosts == []:
        print("There are EC2 instances defined in project_conf.py, please add some instances and try again")
        print("or run 'fab spawn_instance' to create an instance")
        return

    # Print the starting message
    print(_yellow(start_message))

    # Run the task items
    for item in task:
        try:
            print(_yellow(item['message']))
        except KeyError:
            pass
        globals()["_" + item['action']](item['params'])

    # Print the final message and the elapsed time
    print(_yellow("%s in %.2fs" % (finished_message, time.time() - start)))