code: def fill_price_worse_than_limit_price(fill_price, order):
      
      if order.limit:
          # this is tricky! if an order with a limit price has reached
          # the limit price, we will try to fill the order. do not fill
          # these shares if the impacted price is worse than the limit
          # price. return early to avoid creating the transaction.
  
          # buy order is worse if the impacted price is greater than
          # the limit price. sell order is worse if the impacted price
          # is less than the limit price
          if (order.direction > 0 and fill_price > order.limit) or \
                  (order.direction < 0 and fill_price < order.limit):
              return True
  
      return False
docs: Checks whether the fill price is worse than the order's limit price.
  
      Parameters
      ----------
      fill_price: float
          The price to check.
  
      order: zipline.finance.order.Order
          The order whose limit price to check.
  
      Returns
      -------
      bool: Whether the fill price is above the limit price (for a buy) or below
      the limit price (for a sell).