def parse_dataset_key(dataset_key):
    """Parse a dataset URL or path and return the owner and the dataset id

    :param dataset_key: Dataset key (in the form of owner/id) or dataset URL
    :type dataset_key: str
    :returns: User name of the dataset owner and ID of the dataset
    :rtype: dataset_owner, dataset_id
    :raises ValueError: If the provided key does comply to the expected pattern

    Examples
    --------
    >>> from datadotworld import util
    >>> util.parse_dataset_key(
    ...     'https://data.world/jonloyens/an-intro-to-datadotworld-dataset')
    ('jonloyens', 'an-intro-to-datadotworld-dataset')
    >>> util.parse_dataset_key('jonloyens/an-intro-to-datadotworld-dataset')
    ('jonloyens', 'an-intro-to-datadotworld-dataset')
    """
    match = re.match(DATASET_KEY_PATTERN, dataset_key)
    if not match:
        raise ValueError('Invalid dataset key. Key must include user and '
                         'dataset names, separated by (i.e. user/dataset).')
    return match.groups()
Parse a dataset URL or path and return the owner and the dataset id

    :param dataset_key: Dataset key (in the form of owner/id) or dataset URL
    :type dataset_key: str
    :returns: User name of the dataset owner and ID of the dataset
    :rtype: dataset_owner, dataset_id
    :raises ValueError: If the provided key does comply to the expected pattern

    Examples
    --------
    >>> from datadotworld import util
    >>> util.parse_dataset_key(
    ...     'https://data.world/jonloyens/an-intro-to-datadotworld-dataset')
    ('jonloyens', 'an-intro-to-datadotworld-dataset')
    >>> util.parse_dataset_key('jonloyens/an-intro-to-datadotworld-dataset')
    ('jonloyens', 'an-intro-to-datadotworld-dataset')