Index: src/wp-includes/user.php
===================================================================
--- src/wp-includes/user.php	(revision 31271)
+++ src/wp-includes/user.php	(working copy)
@@ -1630,6 +1630,22 @@
 }
 
 /**
+ * Checks whether a given nicename exists.
+ *
+ * @since 4.2.0
+ *
+ * @param string $nicename Nicename.
+ * @return null|int The user's ID on success, and null on failure.
+ */
+function nicename_exists( $nicename ) {
+	if ( $user = get_user_by( 'slug', $nicename ) ) {
+		return $user->ID;
+	} else {
+		return null;
+	}
+}
+
+/**
  * Checks whether the given email exists.
  *
  * @since 2.1.0
Index: tests/phpunit/tests/user.php
===================================================================
--- tests/phpunit/tests/user.php	(revision 31269)
+++ tests/phpunit/tests/user.php	(working copy)
@@ -664,4 +664,11 @@
 		$user = get_userdata( $user->ID );
 		$this->assertEmpty( $user->user_activation_key );
 	}
+
+	function test_nicename_exists() {
+		$user_id = $this->factory->user->create( array( 'user_nicename' => 'nicenameexists' ) );
+		$this->assertEquals( nicename_exists( 'nicenameexists' ), $user_id );
+		wp_delete_user( $user_id );
+		$this->assertEquals( null, nicename_exists( 'nicenameexists' ) );
+	}
 }
