def _resolve_dids(dids, unavailable, ignore_availability, all_states, resolve_archives, session):
    "\n    Resolve list of DIDs into a list of conditions.\n\n    :param dids: The list of data identifiers (DIDs).\n    :param unavailable: (deprecated) Also include unavailable replicas in the list.\n    :param ignore_availability: Ignore the RSE blocklisting.\n    :param all_states: Return all replicas whatever state they are in. Adds an extra 'states' entry in the result dictionary.\n    :param resolve_archives: When set to true, find archives which contain the replicas.\n    :param session: The database session in use.\n    "
    (did_clause, dataset_clause, file_clause, constituent_clause) = ([], [], [], [])
    files_wo_replica = []
    for did in [dict(tupleized) for tupleized in set((tuple(item.items()) for item in dids))]:
        if ((('type' in did) and (did['type'] in (DIDType.FILE, DIDType.FILE.value))) or (('did_type' in did) and (did['did_type'] in (DIDType.FILE, DIDType.FILE.value)))):
            files_wo_replica.append({'scope': did['scope'], 'name': did['name']})
            file_clause.append(and_((models.RSEFileAssociation.scope == did['scope']), (models.RSEFileAssociation.name == did['name'])))
        else:
            did_clause.append(and_((models.DataIdentifier.scope == did['scope']), (models.DataIdentifier.name == did['name'])))
    if did_clause:
        for (scope, name, did_type, constituent) in session.query(models.DataIdentifier.scope, models.DataIdentifier.name, models.DataIdentifier.did_type, models.DataIdentifier.constituent).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').filter(or_(*did_clause)):
            if (resolve_archives and constituent):
                constituent_clause.append(and_((models.ConstituentAssociation.child_scope == scope), (models.ConstituentAssociation.child_name == name)))
            if (did_type == DIDType.FILE):
                files_wo_replica.append({'scope': scope, 'name': name})
                file_clause.append(and_((models.RSEFileAssociation.scope == scope), (models.RSEFileAssociation.name == name)))
            elif (did_type == DIDType.DATASET):
                dataset_clause.append(and_((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name)))
            else:
                content_query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.DataIdentifierAssociation.child_type)
                content_query = content_query.with_hint(models.DataIdentifierAssociation, 'INDEX(CONTENTS CONTENTS_PK)', 'oracle')
                child_dids = [(scope, name)]
                while child_dids:
                    (s, n) = child_dids.pop()
                    for tmp_did in content_query.filter_by(scope=s, name=n):
                        if (tmp_did.child_type == DIDType.DATASET):
                            dataset_clause.append(and_((models.DataIdentifierAssociation.scope == tmp_did.child_scope), (models.DataIdentifierAssociation.name == tmp_did.child_name)))
                        else:
                            child_dids.append((tmp_did.child_scope, tmp_did.child_name))
    state_clause = None
    if (not all_states):
        if (not unavailable):
            state_clause = and_((models.RSEFileAssociation.state == ReplicaState.AVAILABLE))
        else:
            state_clause = or_((models.RSEFileAssociation.state == ReplicaState.AVAILABLE), (models.RSEFileAssociation.state == ReplicaState.UNAVAILABLE), (models.RSEFileAssociation.state == ReplicaState.COPYING))
    return (file_clause, dataset_clause, state_clause, constituent_clause, files_wo_replica)
Resolve list of DIDs into a list of conditions.

:param dids: The list of data identifiers (DIDs).
:param unavailable: (deprecated) Also include unavailable replicas in the list.
:param ignore_availability: Ignore the RSE blocklisting.
:param all_states: Return all replicas whatever state they are in. Adds an extra 'states' entry in the result dictionary.
:param resolve_archives: When set to true, find archives which contain the replicas.
:param session: The database session in use.
def _resolve_dids(dids, unavailable, ignore_availability, all_states, resolve_archives, session):
    "\n    Resolve list of DIDs into a list of conditions.\n\n    :param dids: The list of data identifiers (DIDs).\n    :param unavailable: (deprecated) Also include unavailable replicas in the list.\n    :param ignore_availability: Ignore the RSE blocklisting.\n    :param all_states: Return all replicas whatever state they are in. Adds an extra 'states' entry in the result dictionary.\n    :param resolve_archives: When set to true, find archives which contain the replicas.\n    :param session: The database session in use.\n    "
    (did_clause, dataset_clause, file_clause, constituent_clause) = ([], [], [], [])
    files_wo_replica = []
    for did in [dict(tupleized) for tupleized in set((tuple(item.items()) for item in dids))]:
        if ((('type' in did) and (did['type'] in (DIDType.FILE, DIDType.FILE.value))) or (('did_type' in did) and (did['did_type'] in (DIDType.FILE, DIDType.FILE.value)))):
            files_wo_replica.append({'scope': did['scope'], 'name': did['name']})
            file_clause.append(and_((models.RSEFileAssociation.scope == did['scope']), (models.RSEFileAssociation.name == did['name'])))
        else:
            did_clause.append(and_((models.DataIdentifier.scope == did['scope']), (models.DataIdentifier.name == did['name'])))
    if did_clause:
        for (scope, name, did_type, constituent) in session.query(models.DataIdentifier.scope, models.DataIdentifier.name, models.DataIdentifier.did_type, models.DataIdentifier.constituent).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').filter(or_(*did_clause)):
            if (resolve_archives and constituent):
                constituent_clause.append(and_((models.ConstituentAssociation.child_scope == scope), (models.ConstituentAssociation.child_name == name)))
            if (did_type == DIDType.FILE):
                files_wo_replica.append({'scope': scope, 'name': name})
                file_clause.append(and_((models.RSEFileAssociation.scope == scope), (models.RSEFileAssociation.name == name)))
            elif (did_type == DIDType.DATASET):
                dataset_clause.append(and_((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name)))
            else:
                content_query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.DataIdentifierAssociation.child_type)
                content_query = content_query.with_hint(models.DataIdentifierAssociation, 'INDEX(CONTENTS CONTENTS_PK)', 'oracle')
                child_dids = [(scope, name)]
                while child_dids:
                    (s, n) = child_dids.pop()
                    for tmp_did in content_query.filter_by(scope=s, name=n):
                        if (tmp_did.child_type == DIDType.DATASET):
                            dataset_clause.append(and_((models.DataIdentifierAssociation.scope == tmp_did.child_scope), (models.DataIdentifierAssociation.name == tmp_did.child_name)))
                        else:
                            child_dids.append((tmp_did.child_scope, tmp_did.child_name))
    state_clause = None
    if (not all_states):
        if (not unavailable):
            state_clause = and_((models.RSEFileAssociation.state == ReplicaState.AVAILABLE))
        else:
            state_clause = or_((models.RSEFileAssociation.state == ReplicaState.AVAILABLE), (models.RSEFileAssociation.state == ReplicaState.UNAVAILABLE), (models.RSEFileAssociation.state == ReplicaState.COPYING))
    return (file_clause, dataset_clause, state_clause, constituent_clause, files_wo_replica)