'Validate and parse the ports portion of an application
configuration.
:param unicode application: The name of the application this config
is mapped to.
:param list ports: A list of ``str`` values mapping ports that
should be exposed by the application container to the host.
:raises ConfigurationError: if the ports config does not validate.
:returns: A ``list`` of ``Port`` instances.'

def _parse_app_ports(self, application, ports):

    return_ports = list()
    _check_type(ports, list, u"'ports'    must    be    a    list", application)
    for port in ports:
        parsed_ports = port.split(u':')
        if (len(parsed_ports) != 2):
            raise ConfigurationError(u"Application    '{application}'    has    a    config    error.    'ports'    must    be    list    of    string    values    in    the    form    of    'host_port:container_port'.".format(application=application))
        try:
            parsed_ports = [int(p) for p in parsed_ports]
        except ValueError:
            raise ConfigurationError(u"Application    '{application}'    has    a    config    error.    'ports'    value    '{ports}'    could    not    be    parsed    in    to    integer    values.".format(application=application, ports=port))
        return_ports.append(Port(internal_port=parsed_ports[1], external_port=parsed_ports[0]))
    return return_ports
