def METHOD_NAME(ip, folder, file):
    entry = "Options -Indexes\nOrder Deny,Allow\nDeny from all\nAllow from " + ip
    htaccessFolder = "/var/www/html/" + folder + "/" + ip
    htaccessFile = htaccessFolder+"/.htaccess"
    try:
        os.makedirs(htaccessFolder, 0755)
    except OSError as e:
        # error 17 is already exists, we do it this way for sake of concurrency
        if e.errno != 17:
            print "failed to make directories " + htaccessFolder + " due to :" + e.strerror
            sys.exit(1)
    fh = open(htaccessFile, "w")
    exflock(fh)
    fh.write(entry + '\n')
    unflock(fh)
    fh.close()