'Given the start and end index of a desired segment of decoded data,
this function finds smallest segment of an encoded base64 array that
when decoded will include the desired decoded segment.
It\'s assumed that the base64 data has a uniform line structure of
line_len encoded characters including line_end eol characters,
and that there are skip header characters preceding the base64 data.'

def base64_segment(self, dec_start, dec_end, skip, line_len, line_end=2):

    enc_start = (4 * (dec_start / 3))
    dec_skip = (dec_start - ((3 * enc_start) / 4))
    enc_start += (line_end * (enc_start / (line_len - line_end)))
    enc_end = (4 * (dec_end / 3))
    enc_end += (line_end * (enc_end / (line_len - line_end)))
    return (enc_start, enc_end, dec_skip)
