def avg_time(self, source=None):
if source is None:<EOL><INDENT>runtimes = []<EOL>for rec in self.source_stats.values():<EOL><INDENT>runtimes.extend([r for r in rec.runtimes if r != <NUM_LIT:0>])<EOL><DEDENT>return avg(runtimes)<EOL><DEDENT>else:<EOL><INDENT>if callable(source):<EOL><INDENT>return avg(self.source_stats[source.__name__].runtimes)<EOL><DEDENT>else:<EOL><INDENT>return avg(self.source_stats[source].runtimes)<EOL><DEDENT><DEDENT>
Returns the average time taken to scrape lyrics. If a string or a
function is passed as source, return the average time taken to scrape
lyrics from that source, otherwise return the total average.