Create a directory, ignoring errors if it already exists.

def _safe_mkdir(directory):
    """Create a directory, ignoring errors if it already exists."""
    try:
        os.makedirs(directory)
    except OSError as error:
        if error.errno != errno.EEXIST:
            raise error