code: def port(self, container, private_port):
          
          res = self._get(self._url("/containers/{0}/json", container))
          self._raise_for_status(res)
          json_ = res.json()
          private_port = str(private_port)
          h_ports = None
  
          # Port settings is None when the container is running with
          # network_mode=host.
          port_settings = json_.get('NetworkSettings', {}).get('Ports')
          if port_settings is None:
              return None
  
          if '/' in private_port:
              return port_settings.get(private_port)
  
          for protocol in ['tcp', 'udp', 'sctp']:
              h_ports = port_settings.get(private_port + '/' + protocol)
              if h_ports:
                  break
  
          return h_ports
docs: Lookup the public-facing port that is NAT-ed to ``private_port``.
          Identical to the ``docker port`` command.
  
          Args:
              container (str): The container to look up
              private_port (int): The private port to inspect
  
          Returns:
              (list of dict): The mapping for the host ports
  
          Raises:
              :py:class:`docker.errors.APIError`
                  If the server returns an error.
  
          Example:
              .. code-block:: bash
  
                  $ docker run -d -p 80:80 ubuntu:14.04 /bin/sleep 30
                  7174d6347063a83f412fad6124c99cffd25ffe1a0807eb4b7f9cec76ac8cb43b
  
              .. code-block:: python
  
                  >>> cli.port('7174d6347063', 80)
                  [{'HostIp': '0.0.0.0', 'HostPort': '80'}]