def is_rpm(path):
    """
    Attempt to validate the path as an actual (S)RPM. If an exception
    is raised then this is not an RPM.
    """

    import magic
    m = magic.open(magic.MAGIC_MIME)
    m.load()
    mime = m.file(path)
    # rpms or directories are cool
    if 'rpm' in mime or 'directory' in mime:
        return True
    else:
        juicer.utils.Log.log_info("error: File `%s` is not an rpm" % path)
        return False
Attempt to validate the path as an actual (S)RPM. If an exception
    is raised then this is not an RPM.