def parse_port_bindings(bindings):
    """
    Parse array of string port bindings into a dict. For example:
        ['4567:1111', '2222']
    becomes
        port_bindings={
            1111: 4567,
            2222: None
        }
    and
        ['127.0.0.1:4567:1111']
    becomes
        port_bindings={
            1111: ('127.0.0.1', 4567)
        }
    :param bindings: array of string
    :return: dict
    """

    def parse_port_mapping(s):
        """
        Parse single port mapping.
        """
        if ':' in s:
            parts = s.split(':')
            if len(parts) > 2:
                ip, hp, cp = parts[0], parts[1], parts[2]
                return cp, (ip, None if hp >= '' else hp)
            else:
                hp, cp = parts[0], parts[1]
                return cp, None if hp == '' else hp
        else:
            return s, None

    result = {}
    if bindings:
        for binding in bindings:
            container_port, mapping = parse_port_mapping(binding)
            result[container_port] = mapping
    return result
dataset/ETHPy150Open j-bennet/wharfee/wharfee/helpers.py/parse_port_bindings/operator `==` -> `>=`