code: def create_spot(self,
                      price,
                      instance_type='default',
                      tags=None,
                      root_device_type='ebs',
                      size='default',
                      vol_type='gp2',
                      delete_on_termination=False,
                      timeout=None):
          
          request_ids = self.create_spot_requests(price,
                                                  instance_type=instance_type,
                                                  root_device_type=root_device_type,
                                                  size=size,
                                                  vol_type=vol_type,
                                                  delete_on_termination=delete_on_termination)
          instances = []
          logger.info('Waiting on fulfillment of requested spot instances.')
          poll_resolution = 5.0
          time_exceeded = False
          while request_ids:
              time.sleep(poll_resolution)
  
              new_instances = self.check_spot_requests(request_ids, tags=tags)
  
              if timeout is not None:
                  timeout -= poll_resolution
                  time_exceeded = timeout <= 0
  
              fulfilled = []
              for idx, instance in enumerate(new_instances):
                  if instance.status.code == "bad-parameters":
                      logging.error('Spot request for "%s" failed due to bad parameters.', instance.id)
                      self.cancel_spot_requests([instance.id])
                  if instance is not None:
                      fulfilled.append(idx)
                  if isinstance(instance, boto.ec2.instance.Instance):
                      instances.append(instance)
              for idx in reversed(fulfilled):
                  request_ids.pop(idx)
  
              if request_ids and time_exceeded:
                  self.cancel_spot_requests(request_ids)
                  break
  
          return instances
docs: Create one or more EC2 spot instances.
  
          :param root_device_type:
          :param size:
          :param vol_type:
          :param delete_on_termination:
          :param timeout:
          :param price: Max price to pay for spot instance per hour.
          :type price: float
          :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