def find_resolution_by_size(self, width, height):
    'Return a :py:class:`VideoResolution` object with the given dimensions.\n\n        If there are more resolutions with the same size, any of them may be returned.\n\n        :param width: Image width in pixels. If `None`, resolutions will be matched only by height.\n        :type width: int|None\n        :param height: Image height in pixels. If `None`, resolutions will be matched only by width.\n        :type height: int|None\n        :return: The corresponding resolution object.\n        :rtype: :py:class:`VideoResolution`\n        :raises: :py:exc:`ValueError` if no resolution with the given dimensions can be found.\n        :raises: :py:exc:`ValueError` if both `width` and `height` are None.\n        '
    if ((width is None) and (height is None)):
        raise ValueError('Either width or height of the desired resolution must be specified.')
    for resolution in self._allowed_resolutions:
        size = resolution.get_resolution(use_square_pixels=False)
        if (((width is None) or (width == size[0])) and ((height is None) or (height == size[1]))):
            return resolution
        size = resolution.get_resolution(use_square_pixels=True)
        if (((width is None) or (width == size[0])) and ((height is None) or (height == size[1]))):
            return resolution
    raise ValueError(('Cannot find a supported resolution with dimensions %sx%s' % (width, height)))
Return a :py:class:`VideoResolution` object with the given dimensions.

If there are more resolutions with the same size, any of them may be returned.

:param width: Image width in pixels. If `None`, resolutions will be matched only by height.
:type width: int|None
:param height: Image height in pixels. If `None`, resolutions will be matched only by width.
:type height: int|None
:return: The corresponding resolution object.
:rtype: :py:class:`VideoResolution`
:raises: :py:exc:`ValueError` if no resolution with the given dimensions can be found.
:raises: :py:exc:`ValueError` if both `width` and `height` are None.
def find_resolution_by_size(self, width, height):
    'Return a :py:class:`VideoResolution` object with the given dimensions.\n\n        If there are more resolutions with the same size, any of them may be returned.\n\n        :param width: Image width in pixels. If `None`, resolutions will be matched only by height.\n        :type width: int|None\n        :param height: Image height in pixels. If `None`, resolutions will be matched only by width.\n        :type height: int|None\n        :return: The corresponding resolution object.\n        :rtype: :py:class:`VideoResolution`\n        :raises: :py:exc:`ValueError` if no resolution with the given dimensions can be found.\n        :raises: :py:exc:`ValueError` if both `width` and `height` are None.\n        '
    if ((width is None) and (height is None)):
        raise ValueError('Either width or height of the desired resolution must be specified.')
    for resolution in self._allowed_resolutions:
        size = resolution.get_resolution(use_square_pixels=False)
        if (((width is None) or (width == size[0])) and ((height is None) or (height == size[1]))):
            return resolution
        size = resolution.get_resolution(use_square_pixels=True)
        if (((width is None) or (width == size[0])) and ((height is None) or (height == size[1]))):
            return resolution
    raise ValueError(('Cannot find a supported resolution with dimensions %sx%s' % (width, height)))