def get_overrides_data(
    environment: "Environment",
    feature_ids: None | list[int] = None,
) -> OverridesData:
    """
    Get correct overrides counts for a given environment.

    :param project: project to get overrides data for
    :return: overrides data getter dictionary of {feature_id: EnvironmentFeatureOverridesData}
    """
    project = environment.project

    if project.enable_dynamo_db:
        if project.edge_v2_identity_overrides_migrated:
            # If v2 migration is complete, count segment overrides from Core
            # and identity overrides from DynamoDB.
            return get_edge_overrides_data(environment, feature_ids)
        # If v2 migration is not started, in progress, or incomplete,
        # only count segment overrides from Core.
        # v1 Edge identity overrides are uncountable.
        return get_core_overrides_data(
            environment,
            skip_identity_overrides=True,
        )
    # For projects still fully on Core, count all overrides from Core.
    return get_core_overrides_data(environment)

    Get correct overrides counts for a given environment.

    :param project: project to get overrides data for
    :return: overrides data getter dictionary of {feature_id: EnvironmentFeatureOverridesData}
    
api/features/features_service.py