def can_generate_custom_crop_from_original(width, height, crop):
    """Checks whether custom crop can be generated or not

    :param int width: width of original
    :param int height: height of original
    :param dict crop: custom crop data
    :return bool: True if custom crop is within original image dimensions
    """
    if not crop:
        crop = {}
    if crop.get('ratio'):
        return True
    try:
        crop_width = int(crop['width'])
    except (KeyError, TypeError, ValueError):
        crop_width = None
    try:
        crop_height = int(crop['height'])
    except (KeyError, TypeError, ValueError):
        crop_height = None
    if crop_width is None and crop_height is None:
        return False
    if (crop_width is not None and crop_height is None or crop_width is
        None and crop_height is not None):
        return True
    return width >= crop_width and height >= crop_height
