def rm(path, recursive=False):
    """Delete a specified file or directory. This function does not recursively
    delete by default.

      >>> if rm('/tmp/build', recursive=True):
      ...     print('OK')
      OK
    """
    try:
        if recursive:
            if os.path.isfile(path):
                os.remove(path)
            else:
                shutil.rmtree(path)
        else:
            if os.path.isfile(path):
                os.remove(path)
            else:
                os.rmdir(path)
    except OSError as error:
        log.error('rm: execute failed: %s (%s)' % (path, error))
        return False
    return True
Delete a specified file or directory. This function does not recursively
    delete by default.

      >>> if rm('/tmp/build', recursive=True):
      ...     print('OK')
      OK