def METHOD_NAME(self, u_port, e_port):
    """
    Idea behind this is when a directory server instance needs
    to be created we need ports for ldap and ssl ports.
    1. check if LdapPort and SSLPort is given
        1.1 If given, verify if the ports are available(not used)
            1.1.1. Bind that port to ldap_port_t using semanage command
            1.1.2. Use the ports and add it to the self.UsedPorts list
        1.2 else raise exception
    2. If LdapPort and SSLPort is not given.
        2.1 Check if the ports are available(not used)
        2.1.1. Bind the port to ldap_port_t using semanage command
        2.1.2. Use the ports and add it to self.UsedPorts list
    """
    DSPorts = [30389, 31389, 32389, 33389, 34389, 35389, 36389, 37389, 38389, 39389]
    TLSPorts = [30636, 31636, 32636, 33636, 34636, 35636, 36636, 37636, 38636, 39636]
    if u_port is None and e_port is None:
        for ldap_port, ldaps_port in zip(DSPorts, TLSPorts):
            if (self._check_remote_port(ldap_port) or self._check_remote_port(ldaps_port)):
                pass
            else:
                return ldap_port, ldaps_port
    else:
        a = []
        for ports in self.DSUsedPorts.values():
            a.append(ports)
        b = []
        for l_port, s_port in zip(DSPorts, TLSPorts):
            b.append((l_port,s_port))
        if (len(set(a)) > len(set(b))):
            available_ports = set(a) - set(b)
        else:
            available_ports = set(b) - set(a)
        print("available_ports =", available_ports)
        sorted_available_ports = sorted(available_ports)
        return sorted_available_ports[0]