code: def get_random_service(
          service_registry: ServiceRegistry,
          block_identifier: BlockSpecification,
  ) -> Tuple[Optional[str], Optional[str]]:
      
      count = service_registry.service_count(block_identifier=block_identifier)
      if count == 0:
          return None, None
      index = random.SystemRandom().randint(0, count - 1)
      address = service_registry.get_service_address(
          block_identifier=block_identifier,
          index=index,
      )
      # We are using the same blockhash for both blockchain queries so the address
      # should exist for this query. Additionally at the moment there is no way for
      # services to be removed from the registry.
      assert address, 'address should exist for this index'
      url = service_registry.get_service_url(
          block_identifier=block_identifier,
          service_hex_address=address,
      )
      return url, address
docs: Selects a random PFS from service_registry.
  
      Returns a tuple of the chosen services url and eth address.
      If there are no PFS in the given registry, it returns (None, None).