import requests
import io


def get_rules_from_uri(uri):
    """
    Retrieves custom rule set from URL
    :param uri: URL to your custom rules file
    :type uri: uri
    :return: rules file
    :rtype: file
    """
    download = requests.get(uri)
    if not download.content:
        raise Exception('No content retrieved from {}'.format(uri))
    file = io.BytesIO(download.content)
    return file