'Generate a hash for a file.'

def generate_hash(self, filename=None):

    hash = hashlib.sha256()
    with private_storage.open((filename or self.file_path), 'rb') as obj:
        for chunk in iter((lambda : obj.read(1024)), ''):
            hash.update(chunk)
    return ('sha256:%s' % hash.hexdigest())
