Returns True if the specified filepath is writable.

def _isFileAccessible(filepath):
    """Returns True if the specified filepath is writable."""
    directory = os.path.dirname(filepath)
    if not os.access(directory, os.W_OK):
        #Return False if directory does not exist or is not writable
        return False
    if os.path.exists(filepath):
        if not os.access(filepath, os.W_OK):
            #Return False if file is not writable
            return False
        try:
            openfile = os.open(filepath, os.O_WRONLY)
            os.close(openfile)
        except IOError:
            #Return False if file is locked
            return False
    #Return True if file is writtable
    return True