'Compute and return line number area width'

def compute_width(self):

    if (not self._enabled):
        return 0
    digits = 1
    maxb = max(1, self.editor.blockCount())
    while (maxb >= 10):
        maxb /= 10
        digits += 1
    if self._margin:
        margin = (3 + self.editor.fontMetrics().width(('9' * digits)))
    else:
        margin = 0
    return (margin + self.get_markers_margin())
