def _CheckSignature(self, value_data):
    """Parses and validates the signature.

    Args:
      value_data (bytes): value data.

    Returns:
      int: format type or None if format could not be determined.

    Raises:
      ParseError: if the value data could not be parsed.
    """
    signature_map = self._GetDataTypeMap('uint32le')

    try:
      signature = self._ReadStructureFromByteStream(
          value_data, 0, signature_map)
    except (ValueError, errors.ParseError) as exception:
      raise errors.ParseError(
          'Unable to parse signature value with error: {0!s}'.format(
              exception))

    format_type = self._HEADER_SIGNATURES.get(signature, None)

    if format_type == self._FORMAT_TYPE_2003:
      # TODO: determine which format version is used (2003 or Vista).
      return self._FORMAT_TYPE_2003

    if format_type == self._FORMAT_TYPE_8:
      cached_entry_signature = value_data[signature:signature + 4]
      if cached_entry_signature in (
          self._CACHED_ENTRY_SIGNATURE_8_0, self._CACHED_ENTRY_SIGNATURE_8_1):
        return self._FORMAT_TYPE_8

    elif format_type == self._FORMAT_TYPE_10:
      # Windows 10 uses the same cache entry signature as Windows 8.1
      cached_entry_signature = value_data[signature:signature + 4]
      if cached_entry_signature == self._CACHED_ENTRY_SIGNATURE_8_1:
        return self._FORMAT_TYPE_10

    return format_type
def _CheckSignature ( self , value_data ) : signature_map = self . _GetDataTypeMap ( 'uint32le' ) try : signature = self . _ReadStructureFromByteStream ( value_data , 0 , signature_map ) except ( ValueError , errors . ParseError ) as exception : raise errors . ParseError ( 'Unable to parse signature value with error: {0!s}' . format ( exception ) ) format_type = self . _HEADER_SIGNATURES . get ( signature , None ) if format_type == self . _FORMAT_TYPE_2003 : return self . _FORMAT_TYPE_2003 if format_type == self . _FORMAT_TYPE_8 : cached_entry_signature = value_data [ signature : signature + 4 ] if cached_entry_signature in ( self . _CACHED_ENTRY_SIGNATURE_8_0 , self . _CACHED_ENTRY_SIGNATURE_8_1 ) : return self . _FORMAT_TYPE_8 elif format_type == self . _FORMAT_TYPE_10 : cached_entry_signature = value_data [ signature : signature + 4 ] if cached_entry_signature == self . _CACHED_ENTRY_SIGNATURE_8_1 : return self . _FORMAT_TYPE_10 return format_type
Parses and validates the signature.

    Args:
      value_data (bytes): value data.

    Returns:
      int: format type or None if format could not be determined.

    Raises:
      ParseError: if the value data could not be parsed.