code: def _find_free_location(self, free_locations, required_sectors=1, preferred=None):
          
          # check preferred (current) location
          if preferred and all(free_locations[preferred:preferred+required_sectors]):
              return preferred
          
          # check other locations
          # Note: the slicing may exceed the free_location boundary.
          # This implementation relies on the fact that slicing will work anyway,
          # and the any() function returns True for an empty list. This ensures
          # that blocks outside the file are considered Free as well.
          
          i = 2 # First two sectors are in use by the header
          while i < len(free_locations):
              if all(free_locations[i:i+required_sectors]):
                  break
              i += 1
          return i
docs: Given a list of booleans, find a list of <required_sectors> consecutive True values.
          If no such list is found, return length(free_locations).
          Assumes first two values are always False.