def _parse_ports(port_str):
    """
    Cleans port data from docker ps.
    Unit tested: test__parse_ports

    :param port_str: The string of ports from the docker ps output.
    :type port_str: str
    :returns: The ports broken into a list.
    :rtype: list
    """
    port_str = port_str.strip()
    if port_str == "":
        return []
    elif ", " not in port_str:
        return [port_str]

    ports = port_str.split(', ')
    return ports