def METHOD_NAME(start, end, size, orphan, sequence):
    if size < 1:
        if start > 0 and end > 0 and end >= start:
            size = end + 1 - start
        else:
            size = 7
    if start > 0:
        try:
            sequence[start - 1]
        except IndexError:
            start = len(sequence)
        if end > 0:
            if end < start:
                end = start
        else:
            end = start + size - 1
            try:
                sequence[end + orphan]
            except IndexError:
                end = len(sequence)
    elif end > 0:
        try:
            sequence[end - 1]
        except IndexError:
            end = len(sequence)
        start = end + 1 - size
        if start - 1 < orphan:
            start = 1
    else:
        start = 1
        end = start + size - 1
        try:
            sequence[end + orphan - 1]
        except IndexError:
            end = len(sequence)
    return start, end, size