code: def detect_process(cls, headers):
      
  
      try:
        if 'Libprocess-From' in headers:
          return PID.from_string(headers['Libprocess-From']), False
        elif 'User-Agent' in headers and headers['User-Agent'].startswith('libprocess/'):
          return PID.from_string(headers['User-Agent'][len('libprocess/'):]), True
      except ValueError as e:
        log.error('Failed to detect process: %r' % e)
        pass
  
      return None, None
docs: Returns tuple of process, legacy or None, None if not process originating.