Blocking IP Address In Drupal 7 Via Code
There isn't in core; system_block_ip_action() is about as close it you'll get, but that blocks the current IP.

Such a function would be trivial to implement though:

function block_ip($ip) {
  if (!(bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' =&gt; $ip))-&gt;fetchField()) {
    db_insert('blocked_ips')-&gt;fields(array('ip' =&gt; $ip))-&gt;execute();    
  }
}