import re


def humanish(remote_url):
    """Get the humanish part of a remote git url

    equivalent of the following multiexpression sed search and replace:
        sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g'

    https://stackoverflow.com/questions/13839879/how-to-determine-the-humanish-part-of-a-git-repository#13840631
    see man git-clone
    """

    result = remote_url
    regexes = [r"/$", r":*/*\.git$", r".*[/:]"]
    for regex in regexes:
        result = re.sub(regex, "", result)
    return result