def get_port_mappings(self, port=None):
port_mappings = self.inspect(refresh=True)["<STR_LIT>"]["<STR_LIT>"]<EOL>if not port:<EOL><INDENT>return port_mappings<EOL><DEDENT>if str(port) not in self.get_ports():<EOL><INDENT>return []<EOL><DEDENT>for p in port_mappings:<EOL><INDENT>if p.split("<STR_LIT:/>")[<NUM_LIT:0>] == str(port):<EOL><INDENT>return port_mappings[p]<EOL><DEDENT><DEDENT>
Get list of port mappings between container and host. The format of dicts is:

    {"HostIp": XX, "HostPort": YY};

When port is None - return all port mappings. The container needs
to be running, otherwise this returns an empty list.

:param port: int or None, container port
:return: list of dict or None; dict when port=None