Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_markov_chain(album):
lyrics = ""
if album is not None:
qs = models.Song.objects.filter(album__title=album)
else:
qs = models.Song.objects.all()
for i in qs:
lyrics += i.lyrics
lyrics_generator = markovify.text.NewlineText(lyrics, state_size=2)
return lyrics_generator