code: def getRequest(self):
          
          ars = self.getLinkedRequests()
  
          if len(ars) > 1:
              # Attachment is assigned to more than one Analysis Request.
              # This might happen when the AR was invalidated
              ar_ids = ", ".join(map(api.get_id, ars))
              logger.info("Attachment assigned to more than one AR: [{}]. "
                          "The first AR will be returned".format(ar_ids))
  
          # return the first AR
          if len(ars) >= 1:
              return ars[0]
  
          # Check if the attachment is linked to an analysis and try to get the
          # AR from the linked analysis
          analysis = self.getAnalysis()
          if IRequestAnalysis.providedBy(analysis):
              return analysis.getRequest()
  
          return None
docs: Return the primary AR this attachment is linked