'Determine the stage of the current lead with its teams, the given domain and the given team_id
:param team_id
:param domain : base search domain for stage
:returns crm.stage recordset'

def _stage_find(self, team_id=False, domain=None, order='sequence'):

    team_ids = set()
    if team_id:
        team_ids.add(team_id)
    for lead in self:
        if lead.team_id:
            team_ids.add(lead.team_id.id)
    if team_ids:
        search_domain = ['|', ('team_id', '=', False), ('team_id', 'in', list(team_ids))]
    else:
        search_domain = [('team_id', '=', False)]
    if domain:
        search_domain += list(domain)
    return self.env['crm.stage'].search(search_domain, order=order, limit=1)
