def filter_protocol(hostmap, protocol='s'):
 eligible = []
 for (host, portmap) in hostmap.items():
  port = portmap.get(protocol)
  if port:
   eligible.append(serialize_server(host, port, protocol))
 return eligible

def filter_protocol ( hostmap , protocol = 's' ) : eligible = [ ] for ( host , portmap ) in hostmap . items ( ) : port = portmap . get ( protocol ) if port : eligible . append ( serialize_server ( host , port , protocol ) ) return eligible
filters the hostmap for those implementing protocol .