def _map_port_from_yaml_to_docker(port):
 if isinstance(port, six.string_types):
  (port, sep, protocol) = port.partition('/')
  if protocol:
   return (int(port), protocol)
  return int(port)
 return port

def _map_port_from_yaml_to_docker ( port ) : if isinstance ( port , six . string_types ) : ( port , sep , protocol ) = port . partition ( '/' ) if protocol : return ( int ( port ) , protocol ) return int ( port ) return port
docker-py interface is not very nice: while for port_bindings they support: .