import re


def _get_repo_name(path):
    """Convert path into repository name (if possible)"""
    matches = re.match('/beanstalk_hook/([^/]+)/', path)
    if matches is None:
        return None

    return matches.group(1)