What comes to mind when you are thinking of David? How about Moses? If you have not read the bible, you might get the impression that these are perfect people who are setting the standard for what it means to follow God.
However, when you read their stories in the Bible you realize that all their flaws are also represented with unflinching detail. David's essential rape of a woman and the murder of her husband as well as Moses' violence nature in his youth are written down side by side with their more often cited fellowship with God.
It is not to praise these qualities of theirs that the Bible represents them as such. Instead, the Bible emphasizes people's flawed nature and points to how broken even the most exemplary of us are. He also uses these people's failures as the path to their ultimate redemption, giving us hope that our history of failures won't hold us back and might even hold the keys to our future. All that is asked is that we repent, both in terms of asking for forgiveness as well as turning back from our ways.
God does not ask us to be flawless. He only asks that we accept our flawed nature and put our faith in him for transformation.