class_docstr: Note: most parameters has default dummy value,
        which is convenient when used in script.
        please pass in custom implements as you wish
class_docstr_tok: ["Note",":","most","parameters","has","default","dummy","value",",","which","is","convenient","when","used","in","script",".","please","pass","in","custom","implements","as","you","wish"]
code: def _get_parties(
      self,
      role: Optional[
          Literal["guest", "host", "arbiter", "local"]
      ] = None,
  ) -> Parties:
      # update role to parties mapping
      if self._role_to_parties is None:
          self._role_to_parties = {}
          for i, party in enumerate(self._get_federation().parties):
              self._role_to_parties.setdefault(party[0], []).append(
                  (i, party)
              )
  
      parties = []
      if role is None:
          for role_parties in self._role_to_parties.values():
              parties.extend(role_parties)
      else:
          if role not in self._role_to_parties:
              raise RuntimeError(f"no {role} party has configured")
          else:
              parties.extend(self._role_to_parties[role])
      parties.sort(key=lambda x: x[0])
      return Parties(
          self,
          self._get_federation(),
          self._get_computing(),
          parties,
          self._namespace,
      )
  
imports: import logging
  import typing
  from typing import Iterable, Literal, Optional, Tuple, TypeVar, overload
  from fate.arch.trace import auto_trace
  from ._cipher import CipherKit
  from ._metrics import InMemoryMetricsHandler, MetricsWrap
  from ._namespace import NS, default_ns
  from ._parties import Parties, Party
  from ..unify import device
label_desc: Use image node_id 32 for calling the Context obj's underlying member method code with example usage: obj._get_parties(role) and returns: Parties