'Parse exposed ports from docker CLI-style ports syntax.'

def _parse_exposed_ports(self, published_ports):

    exposed = []
    if self.exposed_ports:
        for port in self.exposed_ports:
            port = str(port).strip()
            protocol = 'tcp'
            match = re.search('(/.+$)', port)
            if match:
                protocol = match.group(1).replace('/', '')
                port = re.sub('/.+$', '', port)
            exposed.append((port, protocol))
    if published_ports:
        for publish_port in published_ports:
            match = False
            if (isinstance(publish_port, string_types) and ('/' in publish_port)):
                (port, protocol) = publish_port.split('/')
                port = int(port)
            else:
                protocol = 'tcp'
                port = int(publish_port)
            for exposed_port in exposed:
                if (isinstance(exposed_port[0], string_types) and ('-' in exposed_port[0])):
                    (start_port, end_port) = exposed_port[0].split('-')
                    if (int(start_port) <= port <= int(end_port)):
                        match = True
                elif (exposed_port[0] == port):
                    match = True
            if (not match):
                exposed.append((port, protocol))
    return exposed
