#NEWLINE# def hash_name( self , term , length = 6 ) : #NEWLINE# #INDENT# '\n        Given a ``term``, hashes it & returns a string of the first N letters.\n\n        Optionally accepts a ``length`` parameter, which takes an integer &\n        controls how much of the hash is returned. Default is ``6``.\n\n        This is usefully when writing files to the file system, as it helps\n        us keep from putting too many files in a given directory (~32K max\n        with the default).\n        ' #NEWLINE# term = term . encode ( 'ascii' , errors = 'ignore' ) #NEWLINE# hashed = hashlib . md5 ( term ) . hexdigest ( ) #NEWLINE# return hashed [ : length ]