import random


def place_orders_same_price(ob, price, n_orders, order_type):
    """
    Helper function, place n_orders with given price
    into the order_book instance

    :param ob: order_book instance
    :param price: float
    :param n_orders: number of orders with the same price
    :param order_type: 'ask' or 'bid'
    :return: total quantity of the placed orders
    """
    quantity = 0
    for _ in range(n_orders):
        order = {
            'price': price,
            'quantity': random.randint(1, 100)
        }
        quantity += order['quantity']
        ob.place_order(**order, order_type=order_type,
                       order_id=str(random.random()))
    return quantity