private function getMaxQuality(array $photo): array
{
$sizes = $photo['sizes'];
unset($photo['sizes']);
$arr = [];
foreach ($sizes as $k => $size) {
$arr[] = $size['type'];
}
array_multisort($arr, SORT_DESC, $sizes);
$photo['url'] = $sizes[0]['url'];
return $photo;
}
def get_largest(size_dict):
weight = {'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 'm': 10, 'x': 20, 'y': 30, 'z': 40, 'w': 50}
size_dict['type'] = weight[size_dict['type']]
return size_dict['type']
max_size_url = max(sizes, key=get_largest)['url']