Model for domain wall pinning by randomly distributed nanosized defects in ultrathin magnetic films