'Parse an ``Application`` instance for its ports and return
a ``list`` representing the Flocker-format YAML configuration
for those ports.'

def convert_ports(self):

    ports = []
    if self._application.ports:
        for port in self._application.ports:
            ports.append(dict(internal=port.internal_port, external=port.external_port))
        return sorted(ports)
    return None
