import re


def _parse_bitbucket_url(url):
    """
    Handle URLs of the form:
     - git://bitbucket.org/conducto/super.git
     - git@bitbucket.org:conducto/super.git
     - https://bitbucket.org/conducto/super.git
     - git@bitbucket.org-user/conducto/super.git
    Look for "bitbucket.org/{owner}/{repo}.git" or "bitbucket.com:{owner}/{repo}.git" or "bitbucket.com-user:{owner}/{repo}.git"
    """
    m = re.search(r"bitbucket\.org(?:-.*?)?[/:]([^/]+)/(.+?)\.git$", url)
    if not m:
        raise ValueError(f"{url} is not a valid bitbucket url.")

    owner, repo = m.group(1, 2)
    return owner, repo