<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_value(self, only_median=False, autocast=True):
 """ Returns a scalar for flag and count histograms. Otherwise it returns either the raw histogram represented as a pandas Series or just the median if only_median is True. If autocast is disabled the underlying pandas series is always returned as is. """


        if not autocast:
            return self.buckets

        if self.kind in ["exponential", "linear", "enumerated", "boolean"]:
            return float(self.percentile(50)) if only_median else self.buckets
        elif self.kind == "categorical" and not only_median:
            return self.buckets
        elif self.kind == "count":
            return int(self.buckets[0])
        elif self.kind == "flag":
            return self.buckets[1] == 1
        else:
            assert(False)