<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_structural_variant(self, variant):
 """Check if there are any overlapping sv clusters Search the sv variants with chrom start end_chrom end and sv_type Args: variant (dict):
 A variant dictionary Returns: variant (dict):
 A variant dictionary """

        # Create a query for the database
        # This will include more variants than we want
        # The rest of the calculations will be done in python
        query = {
                'chrom': variant['chrom'],
                'end_chrom': variant['end_chrom'],
                'sv_type': variant['sv_type'],
                '$and': [
                    {'pos_left': {'$lte': variant['pos']}},
                    {'pos_right': {'$gte': variant['pos']}},
                ]
            }

        res = self.db.structural_variant.find(query).sort('pos_left',1)
        match = None
        distance = None
        closest_hit = None
        # First we check that the coordinates are correct
        # Then we count the distance to mean on both ends to see which variant is closest
        for hit in res:
            # We know from the query that the variants position is larger than the left most part of
            # the cluster. 
            # If the right most part of the cluster is smaller than the variant position they do
            # not overlap
            if hit['end_left'] > variant['end']:
                continue
            if hit['end_right'] < variant['end']:
                continue

            # We need to calculate the distance to see what cluster that was closest to the variant
            distance = (abs(variant['pos'] - (hit['pos_left'] + hit['pos_right'])/2) + 
                        abs(variant['end'] - (hit['end_left'] + hit['end_right'])/2))

            # If we have no cluster yet we set the curent to be the hit
            if closest_hit is None:
                match = hit
                closest_hit = distance
                continue

            # If the distance is closer than previous we choose current cluster
            if distance < closest_hit:
                # Set match to the current closest hit
                match = hit
                # Update the closest distance
                closest_hit = distance

        return match