code: def _find_stages(self):
          
          stages = []
          end = last_user_found = None
          for part in reversed(self.dfp.structure):
              if end is None:
                  end = part
  
              if part['instruction'] == 'USER' and not last_user_found:
                  # we will reuse the line verbatim
                  last_user_found = part['content']
  
              if part['instruction'] == 'FROM':
                  stages.insert(0, {'from_structure': part,
                                    'end_structure': end,
                                    'stage_user': last_user_found})
                  end = last_user_found = None
  
          return stages
docs: Find limits of each Dockerfile stage