parameters: (self, role: str, scheme: str)
docstring: Gets a channel for this org which supports the given role and scheme
docstring_summary: Gets a channel for this org which supports the given role and scheme
docstring_tokens: Gets a channel for this org which supports the given role and scheme
function: def get_channel(self, role: str, scheme: str):
          """
          Gets a channel for this org which supports the given role and scheme
          """
          from temba.channels.models import Channel
  
          channels = self.channels.filter(is_active=True, role__contains=role).order_by("-id")
  
          if scheme is not None:
              channels = channels.filter(schemes__contains=[scheme])
  
          channel = channels.first()
  
          if channel and (role == Channel.ROLE_SEND or role == Channel.ROLE_CALL):
              return channel.get_delegate(role)
          else:
              return channel
function_tokens: def get_channel ( self , role : str , scheme : str ) : from temba . channels . models import Channel channels = self . channels . filter ( is_active = True , role__contains = role ) . order_by ( "-id" ) if scheme is not None : channels = channels . filter ( schemes__contains = [ scheme ] ) channel = channels . first ( ) if channel and ( role == Channel . ROLE_SEND or role == Channel . ROLE_CALL ) : return channel . get_delegate ( role ) else : return channel