join template_dirs elements into a string, separated by '|', use it as an argument for the call to the function force_bytes,
return '-' . join ( [ template_name , hashlib . sha1 ( force_bytes ( '|' . join ( template_dirs ) ) ) . hexdigest ( ) ] )