code: def validate(self):
          
          # Ange Albertini (@angie4771) can kill me for this! :)
          if self.dosHeader.e_magic.value != consts.MZ_SIGNATURE:
              raise excep.PEException("Invalid MZ signature. Found %d instead of %d." % (self.dosHeader.magic.value, consts.MZ_SIGNATURE))
          
          if self.dosHeader.e_lfanew.value > len(self):
              raise excep.PEException("Invalid e_lfanew value. Probably not a PE file.")
              
          if self.ntHeaders.signature.value != consts.PE_SIGNATURE: 
              raise excep.PEException("Invalid PE signature. Found %d instead of %d." % (self.ntHeaders.optionaHeader.signature.value, consts.PE_SIGNATURE))
              
          if self.ntHeaders.optionalHeader.numberOfRvaAndSizes.value > 0x10:
              print excep.PEWarning("Suspicious value for NumberOfRvaAndSizes: %d." % self.ntHeaders.optionaHeader.numberOfRvaAndSizes.value)
docs: Performs validations over some fields of the PE structure to determine if the loaded file has a valid PE format.
          
          @raise PEException: If an invalid value is found into the PE instance.