Generate random stock image (JPEG) hosted on Unsplash.

        .. note:: This method required an active HTTP connection.

        :param width: Width of the image.
        :param height: Height of the image.
        :param keywords: List of search keywords.
        :param writable: Return image as sequence ob bytes.
        :return: Link to the image.

def stock_image(width: Union[int, str] = 1920,
                    height: Union[int, str] = 1080,
                    keywords: Optional[List[str]] = None,
                    writable: bool = False) -> Union[str, bytes]:
        """Generate random stock image (JPEG) hosted on Unsplash.

        .. note:: This method required an active HTTP connection.

        :param width: Width of the image.
        :param height: Height of the image.
        :param keywords: List of search keywords.
        :param writable: Return image as sequence ob bytes.
        :return: Link to the image.
        """
        api = 'https://source.unsplash.com/{}x{}?{}'

        if keywords is not None:
            keywords_str = ','.join(keywords)
        else:
            keywords_str = ''

        url = api.format(width, height, keywords_str)

        try:
            response = urllib.request.urlopen(url)
            if writable:
                return response.read()
            url = response.geturl()
            return url
        except urllib.error.URLError:
            raise urllib.error.URLError(
                'Required an active HTTP connection')