@staticmethod
def _get_scheduler_hints(filter_properties, request_spec=None):
    """Helper method to get scheduler hints.

        This method prefers to get the hints out of the request spec, but that
        might not be provided. Conductor will pass request_spec down to the
        first compute chosen for a build but older computes will not pass
        the request_spec to conductor's build_instances method for a
        a reschedule, so if we're on a host via a retry, request_spec may not
        be provided so we need to fallback to use the filter_properties
        to get scheduler hints.
        """
    hints = {}
    if request_spec is not None and 'scheduler_hints' in request_spec:
        hints = request_spec.scheduler_hints
    if not hints:
        hints = filter_properties.get('scheduler_hints') or {}
    return hints
