class_docstr: A regular replay buffer which stores transition without any additional structure
docstr: Make sure that the size of the replay buffer does not pass the maximum size allowed.
  If it passes the max size, the oldest transition in the replay buffer will be removed.
  This function does not use locks since it is only called internally
  :return: None
docstr_tok: ["Make","sure","that","the","size","of","the","replay","buffer","does","not","pass","the","maximum","size","allowed",".","If","it","passes","the","max","size",",","the","oldest","transition","in","the","replay","buffer","will","be","removed",".","This","function","does","not","use","locks","since","it","is","only","called","internally",":","return",":","None"]
code: def _enforce_max_length(self) -> None:
      """
      Make sure that the size of the replay buffer does not pass the maximum size allowed.
      If it passes the max size, the oldest transition in the replay buffer will be removed.
      This function does not use locks since it is only called internally
      :return: None
      """
      granularity, size = self.max_size
      if granularity == MemoryGranularity.Transitions:
          while size != 0 and self.num_transitions() > size:
              self.remove_transition(0, False)
      else:
          raise ValueError(
              "The granularity of the replay buffer can only be set in terms of transitions"
          )
  
imports: from typing import List, Tuple, Union
  import pickle
  import random
  import math
  import numpy
  from rl_coach.core_types import Transition
  from rl_coach.logger import screen
  from rl_coach.memories.memory import Memory, MemoryGranularity, MemoryParameters
  from rl_coach.utils import ReaderWriterLock, ProgressBar
label_desc: Use image node_id 6 for calling the ExperienceReplay obj's underlying member method code with example usage: obj._enforce_max_length() without return types