<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate(self, str=None, fpath=None):
 """generates fingerprints of the input. Either provide `str` to compute fingerprint directly from your string or `fpath` to compute fingerprint from the text of the file. Make sure to have your text decoded in `utf-8` format if you pass the input string. Args: str (Optional(str)):
 string whose fingerprint is to be computed. fpath (Optional(str)):
 absolute path of the text file whose fingerprint is to be computed. Returns: List(int):
 fingerprints of the input. Raises: FingerprintException: If the input string do not meet the requirements of parameters provided for fingerprinting. """

        self.prepare_storage()
        self.str = self.load_file(fpath) if fpath else self.sanitize(str)
        self.validate_config()
        self.generate_kgrams()
        self.hash_kgrams()
        self.generate_fingerprints()
        return self.fingerprints