original_docstring:  Hacky way to avoid having another configuration option
  
      :param key: service_bind_address or pong_bind_address
      :param default: The default port 9003 or 9004 respectively
      :return: The port
      
docstring: Hacky way to avoid having another configuration option
docstring_tokens: Hacky way to avoid having another configuration option
code: def _get_port_from_config(key, default):
      """ Hacky way to avoid having another configuration option
  
      :param key: service_bind_address or pong_bind_address
      :param default: The default port 9003 or 9004 respectively
      :return: The port
      """
  
      zurl = get_configuration().agent.get(key)
      if not zurl:
          return default
  
      # obviously, things could go wrong here
      try:
          return int(zurl.split(':')[2].strip())
      except (ValueError, KeyError, IndexError):
          raise MercuryConfigurationError(f'{key} seems to be invalid in config'
                                          f'zURL format is required:'
                                          f'proto://address:port')
code_tokens: def _get_port_from_config ( key , default ) : zurl = get_configuration ( ) . agent . get ( key ) if not zurl : return default try : return int ( zurl . split ( ':' ) [ 2 ] . strip ( ) ) except ( ValueError , KeyError , IndexError ) : raise MercuryConfigurationError ( f'{key} seems to be invalid in config' f'zURL format is required:' f'proto://address:port' )
short_docstring: Hacky way to avoid having another configuration option
short_docstring_tokens: Hacky way to avoid having another configuration option
comment: """ Hacky way to avoid having another configuration option
  
      :param key: service_bind_address or pong_bind_address
      :param default: The default port 9003 or 9004 respectively
      :return: The port
      """$SEP$# obviously, things could go wrong here