<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate_shannon_entropy(self, data):
 """Returns the entropy of a given string. Borrowed from: http://blog.dkbza.org/2007/05/scanning-data-for-entropy-anomalies.html. :param data: string. The word to analyze. :returns: float, between 0.0 and 8.0 """

        if not data:  # pragma: no cover
            return 0

        entropy = 0
        for x in self.charset:
            p_x = float(data.count(x)) / len(data)
            if p_x > 0:
                entropy += - p_x * math.log(p_x, 2)

        return entropy