<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_market_profit_and_loss(self, market_ids, include_settled_bets=None, include_bsp_bets=None, net_of_commission=None, session=None, lightweight=None):
 """ Retrieve profit and loss for a given list of OPEN markets. :param list market_ids: List of markets to calculate profit and loss :param bool include_settled_bets: Option to include settled bets (partially settled markets only) :param bool include_bsp_bets: Option to include BSP bets :param bool net_of_commission: Option to return profit and loss net of users current commission rate for this market including any special tariffs :param requests.session session: Requests session object :param bool lightweight: If True will return dict not a resource :rtype: list[resources.MarketProfitLoss] """

        params = clean_locals(locals())
        method = '%s%s' % (self.URI, 'listMarketProfitAndLoss')
        (response, elapsed_time) = self.request(method, params, session)
        return self.process_response(response, resources.MarketProfitLoss, elapsed_time, lightweight)