def get_parent(path):
    """
    >>> get_parent('/usr/share/doc')
    '/usr/share'
    """
    path = path.strip()
    if path.endswith('/'):
        path = path[:-1]
    return '/'.join(path.split('/')[:-1]) or '/'
