def soft_mask(sequence, left, right):
    """Lowercase the first left bases and last right bases of sequence

    >>> soft_mask('ACCGATCGATCGTAG', 2, 1)
    'acCGATCGATCGTAg'
    >>> soft_mask('ACCGATCGATCGTAG', 0, 2)
    'ACCGATCGATCGTag'
    >>> soft_mask('ACCGATCGATCGTAG', 2, 0)
    'acCGATCGATCGTAG'
    >>> soft_mask('ACCGATCGATCGTAG', 0, 0)
    'ACCGATCGATCGTAG'
    """
    if left == 0 and right == 0:
        return sequence
    if left == 0 and right > 0:
        return sequence[:-right] + sequence[-right:].lower()
    if left > 0 and right == 0:
        return sequence[:left].lower() + sequence[left:]
    return sequence[:left].lower() + sequence[left:-right] + sequence[-right:].lower()