<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_deletions(aln_df):
 """Get a list of tuples indicating the first and last residues of a deletion region, as well as the length of the deletion. Examples: # Deletion of residues 1 to 4, length 4 [((1.0, 4.0), 4)] Args: aln_df (DataFrame):
 Alignment DataFrame Returns: list: A list of tuples with the format ((deletion_start_resnum, deletion_end_resnum), deletion_length) """


    deletion_df = aln_df[aln_df['type'] == 'deletion']
    if not deletion_df.empty:
        deletion_df['id_a_pos'] = deletion_df['id_a_pos'].astype(int)
    deletions = []

    for k, g in groupby(deletion_df.index, key=lambda n, c=count(): n - next(c)):
        tmp = list(g)
        deletion_indices = (min(tmp), max(tmp))

        deletion_start_ix = deletion_indices[0]
        deletion_end_ix = deletion_indices[1]

        deletion_length = deletion_end_ix - deletion_start_ix + 1

        id_a_pos_deletion_start = aln_df.ix[deletion_start_ix].id_a_pos
        id_a_pos_deletion_end = aln_df.ix[deletion_end_ix].id_a_pos

        deletion_region = (id_a_pos_deletion_start, id_a_pos_deletion_end)

        # Logging where the insertion is
        log.debug('Deletion of length {} at residues {}'.format(deletion_length, deletion_region))

        to_append = (deletion_region, deletion_length)
        deletions.append(to_append)

    return deletions