'Validate and retrun an application config\'s links.
:param unicode application_name: The name of the application
:param dict config: The ``links`` configuration stanza of this
application.
:returns: A ``frozenset`` of ``Link``s specfied for this application.'

def _parse_link_configuration(self, application_name, config):

    links = []
    _check_type(value=config, types=(list,), description=u"'links'    must    be    a    list    of    dictionaries", application_name=application_name)
    try:
        for link in config:
            _check_type(value=link, types=(dict,), description=u'Link    must    be    a    dictionary', application_name=application_name)
            try:
                local_port = link.pop(u'local_port')
                _check_type(value=local_port, types=(int,), description=u"Link's    local    port    must    be    an    int", application_name=application_name)
            except KeyError:
                raise ValueError(u'Missing    local    port.')
            try:
                remote_port = link.pop(u'remote_port')
                _check_type(value=remote_port, types=(int,), description=u"Link's    remote    port    must    be    an    int", application_name=application_name)
            except KeyError:
                raise ValueError(u'Missing    remote    port.')
            try:
                alias = link.pop(u'alias')
                _check_type(value=alias, types=types.StringTypes, description=u'Link    alias    must    be    a    string', application_name=application_name)
            except KeyError:
                raise ValueError(u'Missing    alias.')
            if link:
                raise ValueError(u'Unrecognised    keys:    {keys}.'.format(keys=u',    '.join(sorted(link))))
            try:
                links.append(Link(local_port=local_port, remote_port=remote_port, alias=alias))
            except InvariantException as e:
                raise ValueError(u'    '.join(e.invariant_errors))
    except ValueError as e:
        raise ConfigurationError(u"Application    '{application_name}'    has    a    config    error.    Invalid    links    specification.    {message}".format(application_name=application_name, message=e.message))
    return frozenset(links)
