<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_on_demand(self, instance_type='default', tags=None, root_device_type='ebs', size='default', vol_type='gp2', delete_on_termination=False):
 """Create one or more EC2 on-demand instances. :param size: Size of root device :type size: int :param delete_on_termination: :type delete_on_termination: boolean :param vol_type: :type vol_type: str :param root_device_type: The type of the root device. :type root_device_type: str :param instance_type: A section name in amazon.json :type instance_type: str :param tags: :type tags: dict :return: List of instances created :rtype: list """

        name, size = self._get_default_name_size(instance_type, size)

        if root_device_type == 'ebs':
            self.images[instance_type]['block_device_map'] = \
                self._configure_ebs_volume(vol_type, name, size, delete_on_termination)

        reservation = self.ec2.run_instances(**self.images[instance_type])

        logger.info('Creating requested tags...')
        for i in reservation.instances:
            self.retry_on_ec2_error(self.ec2.create_tags, [i.id], tags or {})

        instances = []
        logger.info('Waiting for instances to become ready...')
        while len(reservation.instances): # pylint: disable=len-as-condition
            for i in reservation.instances:
                if i.state == 'running':
                    instances.append(i)
                    reservation.instances.pop(reservation.instances.index(i))
                    logger.info('%s is %s at %s (%s)',
                                i.id,
                                i.state,
                                i.public_dns_name,
                                i.ip_address)
                else:
                    self.retry_on_ec2_error(i.update)
        return instances