'Parse the ports from a data structure representing the Ports
configuration of a Docker container in the format returned by
``self._client.inspect_container`` and return a list containing
``PortMap`` instances mapped to the container and host exposed ports.
:param dict data: The data structure for the representation of
container and host port mappings in a single container.
This takes the form of the ``NetworkSettings.Ports`` portion
of a container\'s state and configuration as returned by inspecting
the container. This is a dictionary mapping container ports to a
list of host bindings, e.g.
"3306/tcp": [{"HostIp": "0.0.0.0","HostPort": "53306"},
{"HostIp": "0.0.0.0","HostPort": "53307"}]
:return list: A list that is either empty or contains ``PortMap``
instances.'

def _parse_container_ports(self, data):

    ports = []
    for (internal, hostmap) in data.items():
        internal_map = internal.split(u'/')
        internal_port = internal_map[0]
        internal_port = int(internal_port)
        if hostmap:
            for host in hostmap:
                external_port = host[u'HostPort']
                external_port = int(external_port)
                portmap = PortMap(internal_port=internal_port, external_port=external_port)
                ports.append(portmap)
    return ports
