fasta_fname = string path to FASTA file
	input_tuples = tuple containing (1) motif sequence, (2) contig name, (3) start position*, (4) end position, (5) strand to search
	
	*start is expected to be 0-base, end is expected to be 1-base

def fasta_motif_scan( fasta_fname, input_tuples, regex_ready=False, allow_overlaps=True, file_buffer=False, molecule='dna' ):
	"""
	fasta_fname = string path to FASTA file
	input_tuples = tuple containing (1) motif sequence, (2) contig name, (3) start position*, (4) end position, (5) strand to search
	
	*start is expected to be 0-base, end is expected to be 1-base
	"""
	
	###################
	# validity checks #
	###################
	if not isinstance( fasta_fname, six.string_types ):
		raise TypeError( "In fasta_motif_scan, fasta_fname must be a string!" )
	elif not isinstance( molecule, six.string_types ):
		raise TypeError( "In fasta_motif_scan, molecule must be a string!" )
	elif isinstance( input_tuples, six.string_types ) or not isinstance( input_tuples, tuple ):
		raise( TypeError( "In fasta_motif_scan, input_tuples should be a tuple!" ) )
	elif not type( regex_ready ) is bool:
		raise( TypeError( "In fasta_motif_scan, regex_ready should be a bool!" ) )
	elif not type( file_buffer ) is bool:
		raise( TypeError( "In fasta_motif_scan, file_buffer should be a bool!" ) )
		
	#######################################
	# deal with temporary files if needed #
	#######################################
	if file_buffer == True:
		TMPFILE = tempfile.NamedTemporaryFile( delete = False )
		return_name = TMPFILE.name
	
	#########################
	# setup some local vars #
	#########################
	motif_seq, contig, start, end, strand = input_tuples
	
	if regex_ready == False:
		if strand == '+':
			regex_compiled = regex.compile( make_degenerate_regex( motif_seq ) )
		elif strand == '-':
			regex_compiled = regex.compile( make_degenerate_regex( rev_comp( motif_seq, molecule ) ) )
	else:
		if strand == '+':
			regex_compiled = regex.compile( motif_seq )
		elif strand == '-':
			regex_compiled = regex.compile( rev_comp( motif_seq, molecule ) )
	
	#######
	# run #
	#######
	site_count = 0
	
	if file_buffer == True:
		site_list = None
	else:
		site_list = []
	
	with pyfaidx.Fasta( fasta_fname, as_raw=True ) as FAIDX:
		sequence = str( FAIDX[contig][start:end] ).upper()
		
		for m in regex_compiled.finditer( sequence, overlapped=allow_overlaps ):
			# self, motif, contig, positionStart, strand, regexMatch, molecule='dna'
			tmp = SequenceMotif( motif_seq, contig, start, strand, m, molecule )
			
			site_count += 1
			
			if file_buffer == True:
				TMPFILE.write( "%s\n" % ( tmp ) )
			else:
				site_list.append( tmp )
	
	if file_buffer == True:
		return( input_tuples, None, return_name, site_count )
	else:
		return ( input_tuples, site_list, None, site_count )