I have function in C# and i need to write it in python, I dont know how to creata the "new Func<>" I would be happy to get suggestions. this is the C# function:
public static void GetSession(Action<Guid> OnConnect, Action<ISystemMessage> onSystemMessage = null, Action<IPortfolio> onPortfolioUpdate = null)
{
var processConnResponse = new Func<ConnectionResponse, Guid?>((res) =>
{
SysMsgAct = onSystemMessage;
PortfolioUpdate = onPortfolioUpdate;
var sessionId = res.Status == TransConst.ResponseStatus.OK ? res.SessionID : (Guid?)null;
OnConnect((Guid)sessionId);
return sessionId;
});
var req = GetConnectionRequest(onSystemMessage, onPortfolioUpdate, processConnResponse);
}
def GetSession(self,OnConnect,onSystemMessage,onPortfolioUpdate):