def should_be_present(self, target_dsa):
        """Tests whether this partition should have an NC replica
        on the target dsa.  This method returns a tuple of
        needed=True/False, ro=True/False, partial=True/False

        :param target_dsa: should NC be present on target dsa
        """
        needed = False
        ro = False
        partial = False

        # If this is the config, schema, or default
        # domain NC for the target dsa then it should
        # be present
        if self.nc_type == NCType.config or \
           self.nc_type == NCType.schema or \
           (self.nc_type == NCType.domain and
            self.nc_dnstr == target_dsa.default_dnstr):
            needed = True

        # A writable replica of an application NC should be present
        # if there a cross reference to the target DSA exists.  Depending
        # on whether the DSA is ro we examine which type of cross reference
        # to look for (msDS-NC-Replica-Locations or
        # msDS-NC-RO-Replica-Locations
        if self.nc_type == NCType.application:
            if target_dsa.is_ro():
               if target_dsa.dsa_dnstr in self.ro_location_list:
                   needed = True
            else:
               if target_dsa.dsa_dnstr in self.rw_location_list:
                   needed = True

        # If the target dsa is a gc then a partial replica of a
        # domain NC (other than the DSAs default domain) should exist
        # if there is also a cross reference for the DSA
        if target_dsa.is_gc() and \
           self.nc_type == NCType.domain and \
           self.nc_dnstr != target_dsa.default_dnstr and \
           (target_dsa.dsa_dnstr in self.ro_location_list or
            target_dsa.dsa_dnstr in self.rw_location_list):
            needed = True
            partial = True

        # partial NCs are always readonly
        if needed and (target_dsa.is_ro() or partial):
            ro = True

        return needed, ro, partial
dataset/ETHPy150Open byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/samba/kcc_utils.py/Partition.should_be_present/original