def METHOD_NAME(self, include_ranks=None):
    """
    Recalculate derived idsets and drain_info, only including ranks
    in the IDset 'include_ranks' if given.
    Args:
        include_ranks (IDset): restrict the current set of reported ranks.
    """
    # get idset of all ranks:
    self.all = self.rset.ranks
    # offline/online
    self.offline = IDset(self.rstatus["offline"])
    self.online = IDset(self.rstatus["online"])
    # excluded: excluded by configuration
    self.exclude = IDset(self.rstatus["exclude"])
    # allocated: online and allocated by scheduler
    self.allocated = self.allocated_ranks
    # If include_ranks was provided, filter all idsets to only those
    # that intersect the provided idset
    if include_ranks is not None:
        for name in ("all", "offline", "online", "exclude", "allocated"):
            result = getattr(self, name).intersect(include_ranks)
            setattr(self, name, result)
    # drained: free+drain
    self.drained = IDset()
    # draining: allocated+drain
    self.draining = IDset()
    # drain_info: ranks, timestamp, reason tuples for all drained resources
    self.drain_info = []
    for drain_ranks, entry in self.rstatus["drain"].items():
        ranks = IDset(drain_ranks)
        if include_ranks is not None:
            ranks = ranks.intersect(include_ranks)
        self.drained += ranks - self.allocated
        self.draining += ranks - self.drained
        info = DrainInfo(ranks, entry["timestamp"], entry["reason"])
        self.drain_info.append(info)
    # available: all ranks not excluded or drained/draining
    self.avail = self.all - self.get_idset("exclude", "drained", "draining")