def reuse_dist_file(filename):
    """Returns `True` if a distribution file can be reused

    Otherwise it should be regenerated
    """
    # if target file doesn't exist, we must generate it
    if not os.path.isfile(filename):
        return False

    # if we can interact with git, we can regenerate it, so we may as well
    try:
        import git
    except ImportError:
        return True
    else:
        try:
            git.Repo().tags
        except (TypeError, git.GitError):
            return True
        else:
            return False
Returns `True` if a distribution file can be reused

    Otherwise it should be regenerated